My Opportunities may have up to 4 Product line items. I am trying to copy the 4 Opportunity Product names to 4 Custom text fields. This throws an OpporunityLineItem not defined error and, I'm not sure how to find all line items Thank you {!REQUIRESCRIPT("/soap/ajax/32.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/32.0/apex.js")} var record = new sforce.SObject("Opportunity"); record.Id = '{!Opportunity.Id}'; record.Sample_Product_Name_1__c=OpportunityLineItem.PricebookEntry.Name; 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>>; sforce.connection.update([record]); window.location.reload(); This "should" work by placing everything into one field (Sample_Product_Name_1). Right? This throws an "Invalid or Unexpected token" error {!REQUIRESCRIPT("/soap/ajax/32.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/32.0/apex.js")} var record = new sforce.SObject("Opportunity"); record.oli ='{Select Amount,CloseDate,Name, (Select PricebookEntry.Product2Id, TotalPrice, UnitPrice, ListPrice From OpportunityLineItems) From Opportunity}; record.Id = '{!Opportunity.Id}'; record.Sample_Product_Name_1__c= record.oli; sforce.connection.update([record]); window.location.reload(); Thank you for staying with me on this This does not throw errors but it does not populate the field {!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; window.location.reload();