-
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
Salesforce App Development: Best Practices
One of the great things about Salesforce is its infinite customization options. Not only can you tailor it to suit your unique business needs but…
Send OTP Using Login Flow | Salesforce Developer Guide
Two-factor authentication is the best path to employ for high standards security. This method includes adding a second factor to the login and password, with…
What is the Salesforce Experience Cloud? | The Ultimate Guide
Salesforce Experience Cloud, formerly known as Community Cloud, is a platform designed to help companies build and customize online communities for their customers, partners, and…
Popular Salesforce Videos
Creating Multi Screen Wizard Using Apex and Visualforce Salesforce
Watch this video to learn how to create a Multi-screen wizard using Apex and Visualforce Salesforce. If you have any questions do let us know…
Business Days in Salesforce CRM Analytics (Tableau CRM)
It's common for businesses to want to take business days into account when showing data on a dashboard in CRM Analytics (formerly Tableau CRM) to…
Introduction to Salesforce Shield Platform Encryption | Salesforce Tutorial
Introduction to Salesforce Shield Platform Encryption 0:00 Introduction 1:00 Shield Platform Encryption 2:35 Need for Shield Platform Encryption 3:18 Classic Encryption Vs Shield Platform Encryption…