-
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 Future Trends](https://images.forcetalks.com/wp-content/uploads/2022/06/27175104/Salesforce-Future-Trends.jpg)
Salesforce Future Trends: 5 Major Trends to Watch Out For (2022 - 2023)
Salesforce trends for the year 2022-2023! Has it created too much buzz around? Well, possibly yes! Coz it is worth it… For more than two…
![Salesforce Twilio Integration](https://images.forcetalks.com/wp-content/uploads/2022/06/01110639/Salesforce-Twilio-Integration.jpg)
Salesforce Twilio Integration: A Guide for Easy Integration
In this era, smartphones created a new revolution. It brings a novel approach to our communication habits. Today SMS is a valuable tool for sending…
![What does Salesforce collection mean](https://images.forcetalks.com/wp-content/uploads/2023/05/02170129/What-does-Salesforce-collection-mean.png)
What does Salesforce's Collection mean in 2023?
There are different kinds of collections in Salesforce that can hold a large number of records. Collections are thus sets of documents that belong to…
Popular Salesforce Videos
Salesforce Trailhead - Get Started with the Salesforce Mobile App
After watching this video you'll be able to: Identify the flavors of the Salesforce mobile app available to you. Log in to your Salesforce org…
Salesforce Winter 21 Release - Sneak Peek
The Winter ’21 release delivers innovations across the Salesforce Customer 360 platform to help connect you to your customers, from anywhere. Fancy table updates, live…
Salesforce Marketing Cloud Tutorial | Online Training
Salesforce Marketing Cloud (SFMC) is Salesforce’s platform (or “Cloud”) in the area of marketing automation and customer engagement. It is a SaaS platform made up…