You need to sign in to do that
Don't have an account?
Making Name field unique
Few questions:
I have a class with 'State' and 'Number'. The combination should be unique, and should be the Name field for the table. I'm hitting some road blocks that I suspect are built-in limitations of SF:
- Is there a way to make the Name Field a formula? If there is, I haven't found it.
- Is there a way to require the Name Field to be unique?
- Is there a way to make any Formula Field unique?
One work-around would be using auto-increment for the Name, but this will show up on Lookup Fields, and that's a deal killer. Any suggestions?
Another would be a Trigger that sets the Name before the district is saved and checks for uniqueness. This seems a lot of work for what should be something easy, but I could do it.
Is there an elegant approach. What have people tried?
Hi Riothamus
you can do the following:
1. create a text field (dont put it on the page layout) and set it as unique.
2. Create a workflow on create/edit of the table (edit of the relevant fields if you want to be efficient) that concatenates the two fields you want into the created text field AND to the record name.
this way you get the value you want in the name of the record + uniqueness.
hope this helps - if it does, please mark as solution.
All Answers
Hi Riothamus
you can do the following:
1. create a text field (dont put it on the page layout) and set it as unique.
2. Create a workflow on create/edit of the table (edit of the relevant fields if you want to be efficient) that concatenates the two fields you want into the created text field AND to the record name.
this way you get the value you want in the name of the record + uniqueness.
hope this helps - if it does, please mark as solution.
When you set up a Text field,you will see:
External ID checkbox(null)
Set this field as the unique record identifier from an external system
You can do like this:
Then this field is unique,you can try.
(ISNEW() || ISCHANGED(Name)) && VLOOKUP( $ObjectType.Territory__c.Fields.Name, $ObjectType.Territory__c.Fields.Name , Name) = Name