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
MClovisMClovis 

Preventing Duplicate Records

Hi - First time posting. I need to figure out a way to prevent duplicate record entries.

Firstly, I have created 2 custom objects:

1) Customer Project (Master)
2) Customer Project Team Assignments (Detail)


I need to create a validation rule or workflow rule to restrict a user from selecting a Contact on the Customer Project Team Assignment object that is already associated w/ the same Customer Project object.

The Contact can however be associated w/ different Customer Projects just no duplicates for a single Customer Project.

Does this make sense? Can anyone help? Please ask questions if I've left out some critical information.

Thanks,
Mike

HarmpieHarmpie
To my best knowledge this can only be done by creating an APEX trigger on the Customer Project Team Assignment object. The trigger could intercept once a user creates a duplicate assignement.
TCAdminTCAdmin
Hello MClovis,

There is a good example on page 118 in the Force.com Cookbook. It has an example to prevent Lead emails from being duplicate that would give you a very clear example on how to build this yourself. If you need further assistance then please let me know.
Tyler D.ax299Tyler D.ax299

Chris,

 

I have a similiar issue as MClovis.  The example on page 118 in the Force.com Cookbook appears to prevent duplicates for a single field.  However, I need to write a trigger to prevent duplicates for a field, called Name, of a custom detail table of a Master-Detail relationship, so really there are two fields to consider in the enforcing uniquenes, the Name and the Id of the Master-Detail relationship.  The example on page 118 is unclear how to do that.   Can you provide me a sample of how to do this?

 

Thanks. 

G J.ax1095G J.ax1095

Did you ever figure this out?