-
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

Google Polymer And Salesforce Visualforce Table
We all have heard about Salesforce Lightning Framework in a way or other. Component driven development is the hottest trend in the market these days.…
Popular Salesforce Videos
Create Customers for Life with the Loyal Program in Salesforce
Ever thought about how you can retain your customers in this cutthroat competition in this growing market? A customer loyalty program is one of the…
Email to Case Advance | Converting Cases from Emails Effectively | Salesforce Tutorial
Email-to-Case Advance is an enhanced version of the Salesforce Email-to-Case functionality that converts customer email to cases. It works for Salesforce Service Cloud and provides…
Is Salesforce A Good Career For Freshers?
Wondering whether Salesforce is a good career for freshers or not? Here are all your answers. Join this useful group for Salesforce job & career…