You need to sign in to do that
Don't have an account?
Stavros McGillicuddy
Need to add a loop to get all Opportunity Line Items to this code
This code grabs only one of the Opportunity Line Item names and puts it into a field.
I need to add a loop to grab all Opportunity Line Items for an Opportunity
I need to add a loop to grab all Opportunity Line Items for an Opportunity
{!REQUIRESCRIPT("/soap/ajax/32.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/32.0/apex.js")} var record = new sforce.SObject("Opportunity"); record.Id = '{!Opportunity.Id}'; var retriveOpptyLineItems = sforce.connection.query("Select PricebookEntry.Product2.Name From OpportunityLineItem WHERE OpportunityId = '{!Opportunity.Id}'"); record.Sample_Product_Name_1__c=retriveOpptyLineItems.records[0].PricebookEntry.Product2.Name; sforce.connection.update([record]); window.location.reload();
I have modified the code snippet here:
This snippet is throwing an "Invalid or unexpected token" error