-
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
How To Get Benefits From Salesforce Marketing Cloud?
Salesforce Marketing cloud earlier known as Exact Target provides digital marketing and analytical software and services. Salesforce blazed a trail by creating marketing cloud and…
Drag and Drop Address Field on Google Map | Salesforce Help Guide
Why we need Why we need this type of Address functionality - In the business there are lots of accounts (Person/Business account) and we need…
How to Plan and Execute Successful Salesforce Lightning Migration
In the competitive business landscape of today, staying ahead requires embracing innovation and leveraging the latest technology to enhance productivity and customer satisfaction. For organizations…
Popular Salesforce Videos
Salesforce Work.com New Features
Work.com includes new solutions to accelerate the private and public sector's answer to the COVID-19 pandemic, ranging from contact tracing and emergency response management to…
Salesforce Relationship Considerations
In this video learn about the Important considerations while working with different types of Relationships in Salesforce such as Lookup Relationship, Master-Detail Relationship, Many-to-Many Relationship,…
Salesforce: Learn Workflow Rules in Just 10 min
Workflows in Salesforce are a fantastic way to automate certain business processes. You can create a rule, and based on certain criteria that you set,…