-
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 Security Model - Explained
Salesforce Security Model Salesforce Security Model Classification. Security in Salesforce is broadly classified in two sorts. They are System Level Security. Application Level Security. System…
Everything You Need to Know About Salesforce AI Cloud
With the recent emergence of Artificial Intelligence in the market, businesses are so on the front to get their customer interactions to go smarter and…
Best Practices to Avoid Excessive SOAP and REST API DML | Salesforce Developer Guide
Ensure your code is as efficient as possible when developing integration applications with Force.com SOAP APIs to avoid poor performance or API limit issues. This…
Popular Salesforce Videos
COVID 19 Tracker in Salesforce Lightning Aura Component
In this video, we are developing a lightning Component to track the current pandemic COVID19 Stats Tracker which shows the current situation of all countries…
Salesforce Consumer Goods Cloud Demo
Salesforce Consumer Goods Cloud is an intelligent, seamless B2B CRM solution specifically designed for the consumer goods industry. Watch this video to learn more.
Dreamforce To You 2020 - All Set To Happen
The world has changed, and so has Dreamforce. Instead of everyone coming to Dreamforce, Dreamforce is coming to you — to your kitchen, to your…