-
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
Defining Reporting Snapshots | Salesforce Guide
A reporting picture helps you to record historic records. Authorized customers can keep tabular or summary document outcomes to fields on a custom object, then…
Delegated Authentication Single Sign-On in Salesforce. How to achieve this with Okta?
Delegated Authentication Single Sign-On - We can configure our Salesforce org with any authentication method of our choice using this feature of salesforce. We can…
Learn All About Salesforce Hyperforce
Developing a working relationship with customers is critical to a company's long-term success. A strong connection built on trust and communication makes customers feel more…
Popular Salesforce Videos
Salesforce Financial Services Cloud Spring '23 Highlights
Shake off those winter blues with the new features coming in Salesforce's Spring '23 Release for Financial Services Cloud. Whether it's ARC enhancements, interaction summary…
Done With Training But Not Getting Salesforce Interview Calls, What To Do?
To sum up, choosing a Salesforce Career will be a better option than any other profession seeing the opportunities that it is creating in the…
How to Become a Certified Salesforce Admin
It is predicted there will be 1.9m new Salesforce job openings by 2020. Consultants thinking of a career in IT should consider training in cloud…