Wednesday, 31 January 2018

Validate duplicate record using Workflow in Salesforce

Hi Guys, Here we are going to do a thing that 'How to validate duplicate record using Workflow'.

Now you are thinking What !!, is it really possible without Trigger?


Then I will say, Yes. Do not believe me, Go and implementation firstly before believing me.


Let's Go.


1. Create a field on your object where you want to validate the duplicate records.

We are working here on Account.

Note - When you create a field make sure to True the checkbox and Save.



Create a field and make sure it is ‘Read Only’.

Now, Create a Workflow that updates a field that is created by you.

Now, We have a task that validates duplicate records on the Account object if the Account
Name already exists.

Step 1. Create a field as above image and make sure the ‘Unique’ checkbox is true and save.

Step 2. Now, create a workflow that updates the standard ‘Account Name’ field to your created field ‘Account Name’.

a)  Type ‘Workflow’ in Quick Find Box and select ‘Workflow Rules’ then click on “New Rule”.
b)  Select Your object, here we select the “Account” object and click Next.


c)  Enter your “Rule Name” and “Rule Criteria” (for - when your workflow work ) and click “Save and Next”.

Rule Name – “Test Account Validation using Workflow

Evaluation Criteria - created, and any time it's edited to subsequently meet criteria

      Rule Criteria – Account: Created Date not equal to null


d) Click on “Add Workflow Action” and choose “New Field Update”.


e)  Enter “Name” and “Field to Update” (make sure to choose the custom field which is created by you, here is – “Account Name”).
Click on “Use a formula to set the new value” under the “Specify New Field Value” section and choose Account Name (Standard field) from “Insert Field” to insert in the formula field Text Area and Save.


f) Done and Activate your “Workflow”.



All Done, Test your validation rule using Workflow. Create two records with the same name as the Account.

Pros –
1. No Apex code.
2. Validation using Workflow, so can Deactivate any time. Like – trigger.

Cons –
1. Validation Error does not show on the side of the field.

If you find any Pros & Cons then please comment for the other person and also me.

Thanks for Reading and Implementing 😐😐😐😐😐. 

1 comment:

  1. How do I designate the field of data and contact data in a Visually FORCE Page so that when a data connection is saved, then a contact and an account becomes CREATE?

    ReplyDelete

Total Pageviews