-
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
Salesforce Marketing Cloud vs Mailchimp | The Ultimate Guide
Contents Salesforce Marketing Cloud vs Mailchimp: Choosing the Right Marketing Platform Target Audience Email Marketing Automation Analytics and Reporting Integration Pricing Scalability Support and Training…
Here's How You Can Ease Operations for Your Non-Profit Organization: With a Salesforce Customer Portal
Salesforce's powerful customer portals give you the tools to keep your organization running efficiently and provide your members, donors, and customers with more self-service and…
Steps to enable Chatter and Social Media in Salesforce
Here we will learn how to enable social media and chatter in Salesforce. Let's start from a contact tab and see how it looks without…
Popular Salesforce Videos
How to Find Queries that Target a Data Extension in Salesforce Marketing Cloud
In this video, Cameron Robert shows how to find SQL queries in Automations that affect a specified Data Extension in Salesforce Marketing Cloud. Key Moments:…
How to Integrate QuickBooks with Salesforce?
QuickBooks and Salesforce are two of the most used cloud based software. They are used by small to large scale companies alike and the integration…
AI Cloud: Explore the GPTs of Salesforce
Discover how GPTs, or Generative Pre-trained Transformers, are revolutionizing the way we interact with AI. We break down the complex jargon and show you how…