-
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

Different Clouds in Salesforce and Potential Future
Salesforce offers a range of cloud-based software solutions that are designed to help businesses of all sizes manage their customer relationships, sales and marketing efforts,…

How to implement Salesforce Communities
Salesforce Communities is now considered as an important requirement that helps businesses to establish a connection with their customers, partners as well as employees. Specific…

What are Auto-Launched Flows? | All You Need to Know
What are Auto-launched Flows? A certain event, such as the creation or updating of a record or the receiving of a platform event, can automatically…
Popular Salesforce Videos
Are Privacy laws anti-marketing? - Salesforce, GDPR and CCPA
Are Privacy laws anti-marketing? Or a great marketing opportunity for organizations? Perhaps the underlying question is: Is your Marketing outreach an unwanted nuisance? Or worse,…
Salesforce Admin Certification 2020 Questions Explained with References - Part I
How to prepare and pass Salesforce Admin Certification with Practice Exam Questions 2020 practice questions and answers for the Salesforce Administration Salesforce Certified Admin Exam…
What is Field Dependency in Salesforce and When to use it?
This video gives a complete knowledge of what Field Dependency is in Salesforce. It's divided this topic into 4 major points that are: 1. What…