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
frankjrfrankjr 

programmatically relating records

I have three objects that I'd ike to relate.  Accounts, Sales Documents, and Applications.  The last two are of course, custom objects.  I have one lookup field in each of the custom objects.  One lookup field relates Sales Documents to Applications, and another relates Applications to Accounts. 

 

I want Salesforce to be able to automatically relate the records together based on a unique value in the Sales Document record.  For example, if the discount key field in the Sales Document record matches that found in the Applications record, it'd create the relationship between Application and Sales Document, and create the relationship between Account and Application as well (since the Account is already found on the Sales Document record.)  I'd like to be able to do this automatically when the Sales Document record is saved in Salesforce.  Can anyone point me in the direction for accomplishing this?  Is it Apex code that I need to do?  Triggers? Or can I use workflows?

 

Thanks in advance.

-Frank

IspitaIspita

Hi,

The ideal means of establishing relationship between the three objects records based on the critreria mmentioned by you will be a trigger on the insertion of "Sales document" object and the trigger can contain the logic for checking the libnkage  and connecting the three object records.

 

Hope this helps.