- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
12-06-2012 01:59 PM
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?
Solved! Go to Solution.
12-09-2012 07:05 AM
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.
12-17-2012 01:51 AM
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:
|External ID checkbox(true)||Set this field as the unique record identifier from an external system|
Then this field is unique,you can try.