Another Salesforce blog!!!

Salesforce, Apex

Salesforce – How to determine the value is unique

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.

Leave a Reply

Your email address will not be published. Required fields are marked *