0

I have a field 'Primary contact from opportunity (Custom look up field to Contact object ) which value i wanted to fetch and populate in Customer contact from order object (Custom Look up field to contact object) when this custom lightning button is clicked on opportunity record page.

The value does not get populated in the custom look up field

the custom button works fine in classic but the custom button does not work in populating the value in customer contact field in lightning version

Classic button code as below-

/801/e?retURL=%2F{!Order.Id}&Name={!Opportunity.Name}&opptyid={!Opportunity.Name}&{!Order.Id}&CF00NR0000008LMqj={!Opportunity.Primary_Contact__c}&00NR00000079aKh={!TEXT(Opportunity.Estimated_Freight_Revenue_USD__c)}&retURL=/{!Opportunity.Id}

lightning button code as below

/lightning/o/Order/new?defaultFieldValues=
Name={!URLENCODE(Opportunity.Name)},
OpportunityId={!Opportunity.Id},
ShipToContactId={!Opportunity.Primary_ContactId__c },
Customer_ContactId__c={!Opportunity.Primary_ContactId__c}
Freight_Cost__c= {!TEXT( Opportunity.Estimated_Freight_Revenue_USD__c )}

The above lightning code works well for shiptocontact id which is standard lookup field in standard order object but this does not work well with customer contact id which is custom look up field in sAME standard order objct

2 Answers 2

0

Going just by the URL, I'd say you are missing a comma in the second last line:

/lightning/o/Order/new?defaultFieldValues=
Name={!URLENCODE(Opportunity.Name)},
OpportunityId={!Opportunity.Id},
ShipToContactId={!Opportunity.Primary_ContactId__c },
Customer_ContactId__c={!Opportunity.Primary_ContactId__c},   <======== HERE =========
Freight_Cost__c= {!TEXT( Opportunity.Estimated_Freight_Revenue_USD__c )}
0

Additionally remove the space between variable (field api) and values

for example: /lightning/o/Order/new?defaultFieldValues= Name={!URLENCODE(Opportunity.Name)}, OpportunityId={!Opportunity.Id}, ShipToContactId={!Opportunity.Primary_ContactId__c }, Customer_ContactId__c={!Opportunity.Primary_ContactId__c}, Freight_Cost__c={!TEXT( Opportunity.Estimated_Freight_Revenue_USD__c )}

Refer example: http://theblogreaders.com/set-record-type-id-date-value-enforce-record-type-selection-date-field-values-records-create-page-default-field-values/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.