-
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
Enhance Your Fundraising Efforts by Integrating Your Organization's System With Salesforce
As per Salesforce.org's Nonprofit Trends Report (3rd Edition), the pandemic forced 71 percent of organizations polled to speed up their transition to digital programs or…
Seamless Data Migration: Best Practices in Salesforce Implementation Services
Salesforce CRM is a robust tool with countless applications. Businesses invest in CRM implementation with the goal of managing complex business challenges while achieving no…
Integrating Salesforce with AI and Machine Learning Tools | The Ultimate Guide
Salesforce is a cloud-based customer relationship management (CRM) platform that helps businesses manage their sales, marketing, and customer service operations. Integrating Salesforce with AI and…
Popular Salesforce Videos
Salesforce Workbench | Salesforce Tutorial Video
In this video, we show you how to use Salesforce Workbench to set a user password. This can be useful when you have a user…
How to Use Product Rules with Salesforce CPQ
In this demo video, you'll learn about the three most popular types of product rules for CPQ: validation, alert, and selection. You'll also see how…
Salesforce Certifications 2022 | Which Certifications You Need & Why You Need Them
If you’re looking to start a Salesforce job this year you’re going to need a Salesforce certification. But where do you start, which certification should…