-
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
Using Data to Future Proof Manufacturing Businesses | Salesforce
Ongoing innovations in the manufacturing sector have inspired companies to digitize their operations and find ways to sell and track products online. The digitization of…
How To Plan For A Successful Salesforce Data Migration?
This blog on data migration planning features a brief into towards data migration planning process then it focuses on common data migration issues, the extension…
Popular Salesforce Videos
Running a New Report in Salesforce
After logging into Salesforce, Go to the reporting section by clicking on the Reports tab at the top of the page, Click on the New…
Salesforce: Advanced 'Change Owner' Control in Flow and Apex
Alex Edelstein explains the Salesforce feature known as the 'Change Owner' Control in Flow and Apex. This video is geared toward those already familiar with…
Why Salesforce India is Primed for Growth
Amarendra Kumar, RVP of Alliances and Channels for India at Salesforce, says the region is poised for tremendous growth and opportunity over the next few…