-
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
Integrate Xero With Salesforce
Businesses seamlessly integrate various software platforms that streamline operations, improve efficiency, and enhance the customer experience. One powerful combination of integrating Salesforce, a leading customer…
What is a Test class in Salesforce? | The Ultimate Guide
Testing is an important part of SDLC. So, before deploying our code to the production environment, Salesforce requires at least 75% of your code to…
Salesforce Managed Services: Significance and Important Considerations
Salesforce managed services refer to the team of specialists that are dedicated to providing personalized help depending on the special needs of an organization. Salesforce-managed…
Popular Salesforce Videos
Engineer More Than Software at Salesforce
Salesforce engineers are builders. Together, we’ve created a platform that helps companies around the world connect with their customers. Driven by our commitment to trust,…
Add Intelligence to Any Salesforce App with Einstein Discovery
Bring intelligence in the context on any Force.com app thanks to the power of Einstein Data Discovery. Any Salesforce Admin or Developer can add in…
Agile in Salesforce | Agile Salesforce Implementation
Watch this video to learn about Agile Salesforce Implementation When Salesforce met Agile Agile vs Waterfall Introduction to Scrum Scrum Roles Scrum Ceremonies Q&A