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
Chris HustedChris Husted 

Relationship Question to Establish New Related List

Hello -

Here is a rundown of the current relationships in my org:

Financial Accout (custom object) has a lookup relationship with Account (standard object).
Account Review (custom object) has a lookup relationship set up with Financial Account (custom object).
 
I'm looking to establish a new relationship with Account Review and Account in order to create a new related list on the Account page layout.

Here is where I'm running into issues:

1. Account Review records rely on a web form (hosted by Form Assembly) to be completed for reviews to be submitted in Salesforce. Creating a new Master-Detail Relationship between Account Review and Account throws the form off as it removes the Owner field on the Account Review object. Not to mention, Salesforce will not allow you create the master-detail relationship until every Account Review record has an Account value. We have around 15,000 Account Review records.

2. With that said, creating a new lookup relationship between Account Review and Account works, but not for new reviews that are created (e.g. you'd have to go back into these records once they are submitted via the form and establish the lookup Account value). I believe the answer is no, but Is there a way to automate a lookup relationship field? 

3. I have formula (text) fields set up on Account Review to display the Account fields (name, rep number) in the page layout. Can these formulas somehow be used to establish a one-to-many relationship between Account and Account Review?

Any suggestions out there on how to make this relationship possible?

I appreciate any ideas/help on this one!

Thanks,
-Chris
 
Prateek Singh SengarPrateek Singh Sengar
Hi Chris,
If the Account fields on Account Review object can uniquely identify the Account in your system then yes you can automate the lookup. All you need to do it to create a trigger on Account Review object. It would be an before Insert and before update trigger that will query the account based on the account fields (name, rep number) and create the relationship between account review and account record.
Chris HustedChris Husted
Thank you for your response Prateek. Is it possible for you to provide me with the steps or code needed to create the Advisory Reviews trigger? I appreciate the help on this one!