Odd Even Assignment of Records in Salesforce.com using Workflow Rules

Odd Even Assignment in Salesforce.com using WorkflowsHave you encountered the requirement where you want to assign all Even numbered records to one person and all Odd records to another? Here is a simple solution using the workflow rules that can help. You can use this on custom objects or even on objects that do not have Assignment rules. The requirement can also mean assigning the alternate records to two persons. This is similar to Round Robin assignment to two persons using workflow rules.

Lets define the requirement as:

Assign all records of an object that are of even number to “Joe” and odd number records to “Mary”. The odd or even number can come from a custom field “Record Number”.

Step 1: Auto Number field

Create an auto number field with the format {0}. While creating also give number to existing records (although this will not work on existing records unless you update a field used in workflow criteria). This autonumber field will help us identify a record as Odd or Even.

Lets assume this field is called “Record Number” with an API name as

Record_Number__c

Step 2: Formula field

Create a Formula field that can give an indication if the record is Odd or Even. Lets name this field as “Odd/Even” (or you give any name you want). This field will check of our “Record Number” is Odd or Even.

MOD(value(Record_Number__c),2) +1

Step 3: Workflow rules

Create two workflows – one for assigning Odd records and one for assigning Even records.

Even assignment workflow

Evaluation Criteria

Evaluate the rule when a record is created

Note here we have only considered these rules to run only when created. However even if you want you can also use “Every time it is created or updated …” if your requirement is such.

Rule Criteria

(Name NOT EQUALS ) AND (Odd/Even EQUALS 1)

Note here we have used ‘Name’ NOT Equals as Null in the criteria. Since Name is a mandatory field on this object this workflow will fire each time a new record is created.

Action

Field Update: Record owner (Even): Joe

Odd Assignment workflow

Evaluation Criteria

Evaluate the rule when a record is created

Rule Criteria

(Name NOT EQUALS ) AND (Odd/Even EQUALS 2)

Action

Field Update: Record owner (Odd): Mary

Expanding Odd / Even Assignment

This rule can be expanded further by having multiple fields in the rule criteria. We can also have a custom checkbox “Assign using an active workflow rule” if you want users to manually select a checkbox on record to assign. Make sure you uncheck the checkbox as a workflow action. You can also expand this to assign to more than two persons – however you will need to create as many workflows.

About Jeevan Kumar

Jeevan Kumar (a.k.a. G1) is a Salesforce.com CRM Administrator with Dhruvsoft. His core areas of interest includes Salesforce.com CRM Administration, and Salesforce.com Data Management. He lives in Hyderabad, India and loves to ride motorbikes.

Speak Your Mind

*