-
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 Flows | How to Loop on Multi Select Picklist Values in a Flow?
Want to Parse and Loop on the Multi-Select Picklist Values in a Flow? Parsing the Multi-Select Picklist Selected values in a Flow is required where…
Top Zoho Consulting Services in Australia & Dubai
Zoho Consulting Services in Australia & Dubai: Find the Right Partner for Your Business In today’s fast-paced digital world, businesses need powerful tools to stay…
5 Essential Aspects of a Successful Salesforce Data Security Policy
Data security should never be an afterthought when growing a business. Whether it’s customer data or client lists, or proprietary business information, the importance and…
Popular Salesforce Videos
Salesforce Visualforce and Force.com Development Tutorial || Beginner
Learn to set up a web page using force.com and create forms for users to input information into Salesforce. For more Salesforce tips and tricks…
Difference between Profile and Roles in Salesforce
Learn about the difference between Profile and Roles? Watch this video and do let us know if you have any questions or concerns.
Salesforce Interview Questions and Answers - For Freshers and Experienced Candidates
Learn most important Salesforce Interview Questions and Answers, asked at every interview. These Interview questions will be useful to all entry-level candidates, beginners, interns, and…