function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Roman RiabenskyiRoman Riabenskyi 

JS button on OpportunityLineItem doesn't see standard fields (OpportunityId, Name)

Hello! I need to create a JS button that creates a record on custom object and copies values to the record.
I faced with the problem that OpportunityId and Name fields do not exist but Id field and custom field Reference__c does exist. Maybe you have some thoughts about this?

Here are the code and screenshoots:
var opplineitem = new sforce.SObject("OpportunityLineItem"); 
opplineitem.id = "{!OpportunityLineItem.Id}"; 
opplineitem.oppid = "{!OpportunityLineItem.OpportunityId}";
opplineitem.name  = "{!OpportunityLineItem.Name}";
opplineitem.ref   = "{!OpportunityLineItem.Reference__c}";

User-added image
User-added image