You need to sign in to do that
Don't have an account?

update fields based on a custom field match between objects
Hello,
I am looking to do the following:
When a new case is created with a custom field (Unique ID) populated i want SFDC to find the matching unique ID in an account record and then autopopulate the Account name on the case object.
I appreciate any help i can get!
Thank you,
Leonie
I am looking to do the following:
When a new case is created with a custom field (Unique ID) populated i want SFDC to find the matching unique ID in an account record and then autopopulate the Account name on the case object.
I appreciate any help i can get!
Thank you,
Leonie
Hello,
On case trigger after insert write Select query on account and get the name of account and update or set the field on case object.
this is just sample please use try catch block because you will get errors when you are not able to find the id or submit unrelvant data.
please mark it solved if your issue has been solved
In the above answer, you will have a problem with the governer limit as you are making a DML query inside for loop. It is best practice to always create bulkify triggers and avoid making DML query in for loop. See the below link for the governer limit in apex and trigger best practice.
https://developer.salesforce.com/docs/atlas.en-us.salesforce_app_limits_cheatsheet.meta/salesforce_app_limits_cheatsheet/salesforce_app_limits_platform_apexgov.htm
https://developer.salesforce.com/page/Apex_Code_Best_Practices
You can make your trigger bulkify using this: ( Maybe you have to modify this code for names of your field )
I hope this will help. let me know if you have any queries. if it helps please mark it as the best answer, so others can take help from here.