function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Daniel KDaniel K 

Avoid creating duplicate records if that product already exists

Hi All,
          I have two objects called product and product details. Product field is lookup on product details.
          In product details object, if I have a product detail record pd1 with product p1, I shouldn't be able to create or update 
          another product detail pd2 with product p1.
         
           How can I achieve this?
Best Answer chosen by Daniel K
GauravGargGauravGarg
Hi Daniel,

The best way is with Configuration changes, follow below steps:
  1. Create a formula field on Detail objects. 
  2. Formula will be name/Id of parent object which ever is unique i.e. Parent__r.Id / Parent__r.Name.
  3. Make this formula field as Unique. 

This will not allow to populate P1 on any other product detail until it is tag with PD1. 


Hope this will solve your problem

Thanks,

Gaurav
Skype: gaurav62990
Support : gauravgarg.nmims@gmail.com

All Answers

GauravGargGauravGarg
Hi Daniel,

The best way is with Configuration changes, follow below steps:
  1. Create a formula field on Detail objects. 
  2. Formula will be name/Id of parent object which ever is unique i.e. Parent__r.Id / Parent__r.Name.
  3. Make this formula field as Unique. 

This will not allow to populate P1 on any other product detail until it is tag with PD1. 


Hope this will solve your problem

Thanks,

Gaurav
Skype: gaurav62990
Support : gauravgarg.nmims@gmail.com

This was selected as the best answer
Daniel KDaniel K
but, how do I make formula field as unique ?