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
LyleDLyleD 

Possible to update empty fields based on other fields?

Is it possible to put the following logic into salesforce when the opportunity record is saved. If address 3 is blank, add the data from address 2. If address 2 is blank, add the data from address 1. Is this possible? We deal with 3 type of address fields, Client address, ship to address and physical product location address. Sometimes they are all the sames and sometimes they can all be different.

 

I just want to prevent the user from having to enter in all the address information multiple times if they are all the same. So if all addresses are the same the user doesnt have to fill in that data. This cant just be done using formula fields cause if they are in fact different addresses i need the user to enter each address accordingly.

Best Answer chosen by Admin (Salesforce Developers) 
Rahul_sgRahul_sg
Yes you can achieve it by either creating a Work flow rule with field update action or by writing a before trigger.
1) Using WF rule : You need to write 2 WF rules for this>
In first WF rule check if Address 3 is blank if yes: copy from address 2
In 2nd WF rule :check if address 2 is blank if yes copy from address 1

2) In the Apex trigger you can use the same logic to check if fields are not null and if fields are null you can assign them a constant value or another field's value.

For workflows refer this link: http://na2.salesforce.com/help/doc/en/workflow_defining_field_updates.htm

All Answers

Rahul_sgRahul_sg
Yes you can achieve it by either creating a Work flow rule with field update action or by writing a before trigger.
1) Using WF rule : You need to write 2 WF rules for this>
In first WF rule check if Address 3 is blank if yes: copy from address 2
In 2nd WF rule :check if address 2 is blank if yes copy from address 1

2) In the Apex trigger you can use the same logic to check if fields are not null and if fields are null you can assign them a constant value or another field's value.

For workflows refer this link: http://na2.salesforce.com/help/doc/en/workflow_defining_field_updates.htm
This was selected as the best answer
LyleDLyleD

Thank you very much :)