-
How to compare Trigger.new values with Trigger.old values
I have a junction object 'Related Products' which has master detail relationship with 'Contact' and have a lookup relationship with 'Product'. And I have added a related list of 'Related Products' in Contact detail page where user can create new Related Product from the Contact and can add multiple Products to it.
Now my requirment is "if any user selects a product which is already selected to that contact should through error".
For example, I have contact called "Test Contact111", In it I have created one Related Product "RP-0001" and selected a Product called "Prod111", It will get to save and will show in the Contact's detail page under 'Related Products' section.
Again from the same Contact I will create another Related Product "RP-0002" and again will select the Same Product "Prod111", now the trigger need to throw an error states "Prod111 is already selected"
Log In to reply.
Popular Salesforce Blogs
Salesforce Marketing Cloud
What is Marketing Cloud? To manage the relationship between marketers and customers, we use Marketing Cloud. Salesforce Marketing Cloud is used to make a interaction…
From Off-the-Shelf to Custom: When to Choose Salesforce Development for Maximum Impact
In today's competitive landscape, a robust Customer Relationship Management (CRM) system is no longer a luxury. It is a fundamental necessity. Businesses rely on CRM…
How Can You Get High Output With Salesforce DX and Enjoy Lots of Benefits
What is it that has driven app developers crazy after Salesforce DX? There must be some important reasons and features in it, which makes it…
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,…
12 Highlights of Salesforce Summer’22 Release That You Can’t Miss
The Salesforce Summer '22 release is quickly approaching. We know there are many exciting features coming our way. From the 6th and 7th of May,…
Salesforce Flow Best Practices: Salesforce Flow Design Patterns
Salesforce Flow Design Patterns from Fundamentals to Mastery. In this session, we will talk about the top 10 Salesforce Flow best practices. We will talk…