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
PetyaPetya 

Auto populate custom fields on the opportunity with values from the account object

Hi 

I need your advice to the following problem:

I have the Fields Owner and Responsible on the account and on the opportunity object. When I define an opportunity, I need to fill in these fields with the values from the Account automatically.

With workflow it is not possible to make this. The fields are lookup fields to the User object.

I suppose this is possible with trigger.

 

Does anyone have advices and experiences with similar topic?

Best Answer chosen by Admin (Salesforce Developers) 
BharathimohanBharathimohan

Hi Petya,

 

Yes, you need to Opt for Trigger as Lookup fields cannot be populated by Workdlow rules via field update or you need to pass values via URL.

 

Solution 1:

Hide the 2 lookup fields in the EDIT pagelayout sp that they will not visible when editing/creating a record.

Use trigger to update the values on clicking "Save' button. Hence the fields are visible in the VIEW layout

 

Solution 2:


Pass the values via URL so that the fields will be available both in EDIT & VIEW layout.

Checkout this link Salesforce URL to Prepopulate

 

 

Please Mark this post as solved, if it helps you

 

Regards,

Bharathi
Salesforce For All

 

 

 

All Answers

BharathimohanBharathimohan

Hi Petya,

 

Yes, you need to Opt for Trigger as Lookup fields cannot be populated by Workdlow rules via field update or you need to pass values via URL.

 

Solution 1:

Hide the 2 lookup fields in the EDIT pagelayout sp that they will not visible when editing/creating a record.

Use trigger to update the values on clicking "Save' button. Hence the fields are visible in the VIEW layout

 

Solution 2:


Pass the values via URL so that the fields will be available both in EDIT & VIEW layout.

Checkout this link Salesforce URL to Prepopulate

 

 

Please Mark this post as solved, if it helps you

 

Regards,

Bharathi
Salesforce For All

 

 

 

This was selected as the best answer
PetyaPetya

wow thank you :)