+ Start a Discussion
Rohit ShisodeRohit Shisode 

how to have unique junction object between 2 masters

I have 3 objects Event(Master), Package(Detail) and Group Code(Master). I want only one combination of Event and Group code. So how can i implement this?
Best Answer chosen by Rohit Shisode
Amit Singh 1Amit Singh 1
Extrenal Id field must be as Text type

Update the filed using workflow rule and make sure your rule will run at the time of creating the record only.

In workflow action action select field update and put the formula something like below

Event.Id +'-'+Group_code__c.id

All Answers

Amit Singh 1Amit Singh 1
In junction Object create a formula filed as External Id and value will be Record Id of Event and Record Id of Group Code as External Is can not be duplicate it will work as per your requirement.
 
Rohit ShisodeRohit Shisode
Hello Amit, Thanks for the reply. Should i populate that external id field with workflow rule or is there any other way to add value to that field?
Amit Singh 1Amit Singh 1
Extrenal Id field must be as Text type

Update the filed using workflow rule and make sure your rule will run at the time of creating the record only.

In workflow action action select field update and put the formula something like below

Event.Id +'-'+Group_code__c.id
This was selected as the best answer