For example i have sObject named User, and it contain field name.

How check field name for unique, in input moment?

AND How do that in related many to many Objects?

For example i have three sObjects Territory, Worker, and TerrWorker- many to many table.

Territory->TerrWorker MD

Worker->TerrWorker Lookup

I want that every territory have list of unique workers.

How it is realize?

  • No worker can be in more than one territory? or no worker can appear twice in same territory? – cropredy Jul 12 '16 at 17:04
  • No worker can appear twice in same territory? – Leroy Jul 12 '16 at 17:16

Duplicate Management

This could be performed using Duplicate Management features of the platform.

You would set up a Matching Rule on the TerrWorker object which would reference the combination of Territory and Worker and identify records where duplicates are found.

You would then define a Duplicate Rule to describe what action to take when a duplicate is identified by the Matching Rule.

Uniqueness Constraint

This could also be performed by using a custom text field on TerrWorker which has been marked as Unique and concatenating the Territory.Id and the Worker.Id values and store them in this field. The unique constraint will prevent duplicate record entries of identical Territory + Worker from being created.

Not the answer you're looking for? Browse other questions tagged or ask your own question.