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
dianatdevdianatdev 

Trigger to Update Record Owner

During nightly integration, we have records created on a Loan object that come in as read only.  Since the system integration user creates them they aren't owned by account owners.  I thought that I could use a field update to do this but it appears I will need a trigger.

 

The Loan object has a field for 'Primary Account.'  When the loan is created in the system via nightly integration, we would like a trigger to look at who the Owner is of the Primary Account and update the Loan owner to that user.

 

Ex.  Loan for John Smith comes into the system.  The 'Primary Account' is "John Smith's Account."  The Owner of John Smith's account is "Mary Black."  So on create into the system, the loan owner should be Mary Black, not "System Integration User."

 

I'm new to triggers so any help getting me started on this is appreciated.