-
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
Learn All About Salesforce Marketing Cloud and its Editions
The goal of marketing is to generate interest in the goods or services that your business offers. Marketing drives sales, resulting in an influx of…
What are the Common Challenges in the Salesforce Classic to Lightning Migration Process?
Salesforce delivers almost everything a business requires to manage its operations efficiently. It is a comprehensive Customer Relationship Management (CRM) platform that facilitates top-level management…
Detailed Overview of Salesforce Einstein 1 Studio
In the recent stage of AI growth, customization has been at the forefront of innovation. Salesforce has made an advancement in this trend, presenting Einstein…
Popular Salesforce Videos
How to Test Your Process Builder | Salesforce
In this video, Appopedia provides helpful tips on how to test your process builder in Salesforce. She explains how to create a test user, what…
Salesforce Admin Introduction - Salesforce Admin Tutorial
Salesforce Administrators work with stakeholders to define system requirements and customize the platform. To put it simply, they enable users to get the most out of…
How to Set Up Salesforce Customer Community
Step by Step Salesforce tutorial for quickly setting up a Customer Community with Customer Service (Napili) Template.