-
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
Setting SSO between Salesforce and Okta’s Custom Application using SAML 2.0 protocol
1. SSO(Single Sign On between Okta as Identity Provider and Salesforce as Service Provider) Steps to setup SSO between Salesforce and Okta:- Log in to…
Salesforce Experience Cloud For Partners
Unlocking Salesforce Experience Cloud's Potential for Partners In today’s digital world, companies are increasingly turning to technology to help them manage and optimize their partner…
Save hours off your workweek with Celigo's Excel SmartClient for Salesforce
Celigo's Excel SmartClient is a powerful tool that can be used to retrieve data from Salesforce into Excel. Once in Excel the data can be modified…
Popular Salesforce Videos
What is Approval Process in Salesforce?
Automated process that approves records for the organization and it can be defined with a sequence of steps. Watch the video to learn and if…
What is a Salesforce PDO Partner?
Salesforce market is growing very fast these years. It is estimated that in 2021 the Salesforce ecosystem will be worth around 100 billion U.S. dollars.…
DreamTX Welcome Day 2 | Dreamforce 2020 | Salesforce
If you missed DreamTX DAY 2, then live this amazing experience here, we have covered it all for you. See the power of Customer 360,…