-
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
What is Salesforce CPQ - Why Does Every Business Need it?
Introduction Business statistics prove SDR spends time on creating proposals rather than closing deals. It is apparent that the sales management process becomes insignificant when…
Introduction to Lightening Web Components | The Ultimate Guide
Lightning Wеb Componеnts (LWC) arе a nеw framеwork for building UI componеnts for Salеsforcе apps. LWCs usе standard wеb languagеs likе HTML, CSS, and JavaScript…
Twilio Integration With Salesforce Part I - How to Send A Message From Salesforce to a Phone Number
This blog is the first part of Two part blog on Integrating your Twilio Account with Salesforce. In this blog, I will be displaying how…
Popular Salesforce Videos
How you can Increase your Salesforce Efficiency and Productivity
In this video, Brad discusses how to increase your workplace efficiency and productivity using various Google Chrome extensions and techniques. As always, we have linked…
Salesforce Health Cloud
Salesforce Health Cloud is a health IT CRM system that incorporates doctor-patient relationship and record management services. Through Private Communities, patients can view care plans,…
Salesforce Tutorial - How to Create Custom App in Salesforce
Apps, Tabs, Objects are basic Building Blocks of Salesforce. In this video, I am explaining how exactly you will able to develop a custom app…