You need to sign in to do that
Don't have an account?
Jaimin
HOW TO MAKE A LOOKUP FIELD UNIQUE IN CUSTOM OBJECTS
I am creating two custome objects (Employees, Device).
Create a Lookup relationship to assign a device to the employee. Employee can have multiple devices but Device have only one employee.
After assign the device to the employee that device can not be reassign till device can free.
How to make a Lookup relationship unique.
Create a Lookup relationship to assign a device to the employee. Employee can have multiple devices but Device have only one employee.
After assign the device to the employee that device can not be reassign till device can free.
How to make a Lookup relationship unique.
Can you elaborate a bit more on it?
1. Employees
2. Device
3. Assign
In Assign Tab, Create Master-Relationship with Employees and Lookup with Device.
I am trying to do like these in assign oobject when device assign to employee.
Employee Device
E1 D1
E2 D2
E3 D1 (Error: This device already assign)
Here with the Assign Object, you have create a Many to Many relationship (junction object).
But what you are actually required as per your statement is a One(Employee) - Many(Devices) relationship. Perhaps a simple lookup or a MD relationship should have worked here.
But still if your architecture requires this structure, what I can suggest you it to create a flag field on Device (isAssigned), which will be populated using a trigger, as soon a Device is associated to an Assign object the trigger will update this flag as true.
And then write a validation rule on Assign to not associate itself to a device if this flag is checked.
Let me know if it helped.