-
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
Test Class in Salesforce - All You Need To Know
Below are some of the key points to note about the Test Class in Salesforce: Test Classes and test methods verify whether a particular piece…
What is a Flow in Salesforce? | All You Need to Know
A flow is a tool that automates complications of business processes in Salesforce. In a few words, it fetches data and then Proceeds with that…
Read this before you choose your Salesforce Consultant
So, you’ve decided on Salesforce, the World’s #1 CRM as your preferred Cloud computing platform, which is a great choice! Salesforce is one of most comprehensive CRM…
Popular Salesforce Videos
Emails and Cases in Salesforce Lightning Experience
In this video, Jodie Miners gives an in-depth look at some of the features and potential issues with emails in cases in Lightning Experience. He…
Integrating a Node.js Application with Salesforce
Watch this video where we will explore how to integrate a Node.js web application with Salesforce using Heroku Connect and JSForce. You can work with…
How to Get Jobs or Work Outside India | Salesforce Developer vs Cloud Professional
In this Video Shrey covered answers to the three questions which are: 1. How do you find a job in Salesforce as a fresher or…