0

I have a formula field to display after concatenate the three different fields value.

formula shown below:

 TEXT(Account_Code__c) & "-" &  TEXT(Account_Code2__c) & "-" &  TEXT(Account_Code3__c)

My question is, is there a way I can validate to see if the concatenate value is unique not duplicate?

I'm using standard page.

What is the best options are available for me and how to achieve the unquieness

  • well, nice way would be use trigger for it. Easy way -- one more unique field, and workflow that assign that field to value of this formula every time when one of the codes has been changed – kurunve Jul 5 '16 at 21:23
  • or workflow to assign to custom field + Duplicate Management – cropredy Jul 5 '16 at 21:32
3

I did something similar in the past by using the following steps:

  1. Create a text field and mark it unique
  2. Create a Workflow Rule that fires always (on create and every update) and updates that new text field with the formula you want.

When entering a record that will make a duplicate happen, the update will fail because the WFR won't be able to update the field.

1

I went ahead with workflow since its easy to implement then trigger, here are the step by step, hope this will help others too:

At first let us create a new Field on the custom object/standard object.

1. Go to Setup | Customize | Accounts | Fields.
2. Scroll down to Custom Fields & Relationships Section.
3. Click New Field.
4. Select the Type as: Text
5. Name it as: Account Name Dupe Check[Field_Name_Dupe_Check, 255].
6. Check the Option: Unique and also select: 'Treat "ABC" and "abc" as different values (case sensitive)'.
7. Make it Visible for the appropriate Profiles. While you make them Visible also check the Option: 'Read Only'.
8. You need not put them on the Page Layouts.

Now, let us create a new Workflow Rule[Account Dupe Check].

1. Go to Setup | Create | Workflows & Approvals | Workflow Rules.
2. Click New Rule.
3. Select the Object: custom or standard object 
4. Evaluation Criteria: created and every time it's edited.
5. Rule Criteria: criteria are met.
6. Field: select your field OPERATOR: not equal to
7. Save & Next.
8. From under Immediate Actions, click Add Workflow Action to select 'Field Update'[Set the Name].
9. Select the Field to Update: object Name Dupe Check
10. Select: Use a formula to set the new value
11. In the formula box, type in 'Name'.
12. Click Save.
13. Click Done.
14. Activate the WFR.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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