Show Related Lead number in Opportunity
The following example illustrates how you can get an Opportunity page to display the associated lead number:
-
Create a new sandbox in Application Composer.
See "Create and Activate Sandboxes" in the Configuring and Extending Applications guide.
-
In Application Composer, expand Opportunity and do the following:
-
Go to the Fields page and create a custom text field named Lead Number.
See "Text Fields" in the Configuring Applications Using Application Composer guide.
-
On the Triggers tab of the Scripts page, add a new BeforeUpdate trigger and enter the following in the Trigger Definition script section:
if (LeadNumber_c == null || LeadNumber_c == ''){ def leads = OpportunityLead if (leads.hasNext()){ def a = leads.first() LeadNumber_c = a.LeadNumber } }See "Server Scripts" in the Configuring Applications Using Application Composer guide for more information.
-