-
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
Meet Astro, Codey & Friends | The Salesforce Trailhead Family
Salesforce changed the way people perceived business software when it launched in 1999. Marc Benioff, CEO of Salesforce, imagined making software easier to buy, use…
What is the Future Scope of Salesforce CRM?
Nowadays the adoption of Salesforce CRM is increasing at a tremendous pace. As per reports, Salesforce dominated the worldwide CRM market with a market share…
Salesforce Customization: Overcoming CRM Limitations for Growing Companies
Salesforce CRM has a complex, multilayered structure that can be adaptive to many business scenarios. Unfortunately, businesses can sometimes face Salesforce limitations (during business scaling,…
Popular Salesforce Videos
Auditing Account Deletion Using Salesforce Flow
This demo video walks through an example of Auditing Account Deletion Using Salesforce Flow Ever had an instance where users have accidentally deleted Accounts and…
Girikon Salesforce Expertise - Salesforce Silver Consulting Partner
Girikon has experienced and certified Salesforce Consultants are available to meet your entire gamut of Salesforce Implementation, Development, Customization, Integration and Support needs. Get salesforce…