-
How can I add a lookup relationship using an external id on a before insert/update trigger in Salesforce?
I would like to create a lookup relationship to a parent object using the parents external id from a before insert/update trigger. I am not receiving an error when I do this, but it is not creating the relationship. I have tested using anonymous apex with a dml and the code works fine. In the example, Tech1_ID__c is the external id of the Property__c object.
trigger CaseAddressHandler on Case (before insert, before update) {
for(Case c: trigger.new){
c.Property__r = new Property__c(Tech1_ID__c =c.Property_Id__c);
}
}
Log In to reply.
Popular Salesforce Blogs
Understanding Process Builder in Salesforce
What is Process Builder in Salesforce? Presently, since you have found out about Workflow and Apex Trigger, it's the ideal opportunity for you to find…
Apex Batch - Use of Interface Database.Stateful in Batch Class
Hello guys, Today, we will talk about interface named as Database.Stateful, it is used when we want to maintain the state across the batch call…
Popular Salesforce Videos
Schedule Apex Jobs with Lighting Web Components | Developer Quick Takes
Lightning Web Components gives you the ability to give your users a great user experience when interacting with Salesforce. In this example, we will take…
Can Non-IT People Make their Career In Salesforce?
This video focuses on if non-IT people can make a career in Salesforce. Salesforce is a customer relationship management (CRM) platform that offers various roles…
Is Salesforce A Good Career Path?
Join this useful group for Salesforce job & career info: https://tinyurl.com/TelegramIntelogik Contact us for any Salesforce career guidance. Watch this video and learn. do let…