-
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
All You Need to Know About Creating Free Salesforce Developer Account
Are you struggling to create a Free Salesforce Developer Account? Do you think you could not find the right resources to guide you step-wise free…
2020 Branding Guidelines for Partners in the Salesforce Ecosystem
The Salesforce Partner Program gives the opportunity to its partners to build and grow successful businesses while delivering customer success. With this program, Independent Software…
Salesforce Projects: Let's Spot the Trouble Before It Starts!
Imagine building a house. You wouldn't just start hammering without a plan, right? You'd check the soil, consider weather, and make sure you have the…
Popular Salesforce Videos
Salesforce Marketing Cloud Email Studio | Marketing Cloud Tutorial
Learn all about Salesforce marketing cloud email studio. In this video, the following points will be covered - 1. Overview Of Email Studio & Content…
Salesforce training video for beginners
Salesforce is an innovative tool that can be very powerful when used properly. That’s why it’s important to find effective and trustworthy ways to learn…
Install Adobe Sign & Send Agreements For E-sign in Salesforce
Learn the steps involved in installing Adobe Sign and sending agreements for e-sign in Salesforce. This tutorial will cover the following points - 1. Install…