+ Start a Discussion
Stavros McGillicuddyStavros McGillicuddy 

Syntax to reference Opportunity>Product Line Items

My opportunities may have up to 4 products (line items) attached to them.
I am looking for the syntax to copy the 4 Opportunity > Product Names to 4 custom fiedls on the Opportunity object

This does not throw an error but it does nothing

Stavros McGillicuddyStavros McGillicuddy
More experimenting..

This throws an OpporunityLineItem not defined error and, I'm not sure how to find all line items
Thank you

var record = new sforce.SObject("Opportunity"); 
record.Id = '{!Opportunity.Id}'; 

record.Sample_Product_Name_2__c= <<The next line item Name>>; 
record.Sample_Product_Name_3__c= <<The next line item Name>>; 
record.Sample_Product_Name_4__c= <<The next line item Name>>;