-
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
Files, Attachments And Notes Salesforce Lightning Components | Force.com
Download Notes & Attachments from Force.com Site of Lightning Component Create an email alert that will be sent to the Opportunity Owner. This email will…
5 Things To Consider When Switching From Salesforce Classic To Lightning
Are you still, using Salesforce Classic? If yes, don't hold your breath for anything "new and exciting" to arrive anytime soon. The best method to…
How Does a Post Install Script Work? - Salesforce Developer Guide
Post-Install Script is the same as other apex classes. And the apex class which is executed when a managed package is installed or upgraded. This…
Popular Salesforce Videos
Introduction to Salesforce CTA Exam
The average salary for a Technical Architect is $118,324 per year in the United States. Do you also want to become Technical Exam by cracking…
Top 5 FAQs' of Salesforce Commerce Cloud
Salesforce Commerce Cloud, formerly known as Demandware, is a user-friendly and streamlined e-Commerce platform designed with a simple goal to help a company expand its…
Salesforce Chatter Tutorial | Chatter Overview And Demo | Chatter In Salesforce
This Salesforce Chatter Tutorial will give an overview of Chatter which includes enabling chatter, configuring chatter groups and creating customer groups. Salesforce Chatter will be…