-
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
![](https://images.forcetalks.com/wp-content/uploads/2020/02/20100507/FT-Banners-5-4.png)
Salesforce Governor Limits
Before starting to know all the rules(which we are always so excited to follow.Not!). We need to know why we need all these rules(which Salesforce…
![Steps To Connect Marketing Cloud & Salesforce Org](https://images.forcetalks.com/wp-content/uploads/2018/03/25082459/Steps-To-Connect-0AMarketing-Cloud-Salesforce-Org.png)
Steps To Connect Marketing Cloud and Salesforce Org
Before installing Marketing Cloud Connect, you need to keep the following Things in your mind - Review the Features page to understand compatibility and product versions. Marketing…
![](https://images.forcetalks.com/wp-content/uploads/2023/07/21065820/sa_1689922681Video%20Full%20HD%201920x1080%20px-1024x576.png)
Migrate Attachments and Files Seamlessly with iSyncSF: Your Trusted Salesforce Data Migration Solution
Salesforce is a powerful CRM platform that allows businesses to store and manage a variety of data, including attachments and files. When migrating data from…
Popular Salesforce Videos
How To Use Salesforce Campaigns in Pardot
Learn campaign basics to help you plan your marketing strategy. In this video, Pardot experts guide you in: - Defining campaigns in Pardot and Salesforce…
Getting to Know Einstein Analytics
Einstein Analytics is an app used to visualize the activity occurring in your Salesforce environment. Whether you use Salesforce for Sales, Marketing, or Service, this…
Build Multi-Column Screens in Flow Builder - Spring'21 feature for the Salesforce Screen Flows
Build Multi-Column Screens in Flow Builder (Pilot) You can divide each flow screen into multiple sections and columns to create a visually appealing and effective…