{"id":366,"date":"2016-05-04T20:46:48","date_gmt":"2016-05-04T15:16:48","guid":{"rendered":"https:\/\/www.dhruvsoft.com\/blog\/?p=366"},"modified":"2024-07-26T09:44:44","modified_gmt":"2024-07-26T09:44:44","slug":"odd-even-assignment-of-records-in-salesforce-com-using-workflow-rules","status":"publish","type":"post","link":"https:\/\/www.dhruvsoft.com\/blog\/odd-even-assignment-of-records-in-salesforce-com-using-workflow-rules\/","title":{"rendered":"Odd Even Assignment of Records in Salesforce.com using Workflow Rules"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-medium wp-image-368\" src=\"https:\/\/www.dhruvsoft.com\/blog\/wp-content\/uploads\/2016\/05\/Odd-Even-Assignment-179x300.png\" alt=\"Odd Even Assignment in Salesforce.com using Workflows\" width=\"179\" height=\"300\" srcset=\"https:\/\/www.dhruvsoft.com\/blog\/wp-content\/uploads\/2016\/05\/Odd-Even-Assignment-179x300.png 179w, https:\/\/www.dhruvsoft.com\/blog\/wp-content\/uploads\/2016\/05\/Odd-Even-Assignment.png 559w\" sizes=\"auto, (max-width: 179px) 100vw, 179px\" \/>Have 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.<\/p>\n<p>Lets define the requirement as:<\/p>\n<blockquote><p><strong><em>Assign all records of an object that are of even number to &#8220;Joe&#8221; and odd number records to &#8220;Mary&#8221;. The odd or even number can come from a custom field &#8220;Record Number&#8221;.<\/em><\/strong><\/p><\/blockquote>\n<h4><\/h4>\n<p><!--more--><\/p>\n<h4>Step 1: Auto Number field<\/h4>\n<p>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.<\/p>\n<p>Lets assume this field is called &#8220;Record Number&#8221; with an API name as<\/p>\n<pre>Record_Number__c<\/pre>\n<h4>Step 2: Formula field<\/h4>\n<p>Create a Formula field that can give an indication if the record is Odd or Even. Lets name this field as &#8220;Odd\/Even&#8221; (or you give any name you want). This field will check of our &#8220;Record Number&#8221; is Odd or Even.<\/p>\n<pre>MOD(value(Record_Number__c),2) +1<\/pre>\n<h4>Step 3: Workflow rules<\/h4>\n<p>Create two workflows &#8211; one for assigning Odd records and one for assigning Even records.<\/p>\n<h5>Even\u00c2\u00a0assignment workflow<\/h5>\n<p><strong>Evaluation Criteria <\/strong><\/p>\n<p>Evaluate the rule when a record is created<\/p>\n<p>Note here we have only considered these rules to run only when created. However even if you want you can also use &#8220;Every time it is created or updated &#8230;&#8221; if your requirement is such.<\/p>\n<p><strong>Rule Criteria<\/strong><\/p>\n<pre>(Name NOT EQUALS ) AND (Odd\/Even EQUALS 1)<\/pre>\n<p>Note here we have used &#8216;Name&#8217; 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.<\/p>\n<p><strong>Action<\/strong><\/p>\n<p>Field Update:\u00c2\u00a0Record owner (Even):\u00c2\u00a0Joe<\/p>\n<h5>Odd\u00c2\u00a0Assignment workflow<\/h5>\n<p><strong>Evaluation Criteria <\/strong><\/p>\n<p>Evaluate the rule when a record is created<\/p>\n<p><strong>Rule Criteria<\/strong><\/p>\n<pre>(Name NOT EQUALS ) AND (Odd\/Even EQUALS 2)<\/pre>\n<p><strong>Action<\/strong><\/p>\n<p>Field Update:\u00c2\u00a0Record owner (Odd):\u00c2\u00a0Mary<\/p>\n<h4>Expanding Odd \/ Even Assignment<\/h4>\n<p>This rule can be expanded further by having multiple fields in the rule criteria. We can also have a custom checkbox &#8220;Assign using an active workflow rule&#8221; 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 &#8211; however you will need to create as many workflows.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have 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 [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[66,128],"tags":[141,117,50,51,142],"class_list":["post-366","post","type-post","status-publish","format-standard","hentry","category-declarative-customization","category-sales-cloud","tag-assignment-rules","tag-sales-cloud","tag-salesforce","tag-salesforce-com","tag-workflow-rules","entry"],"_links":{"self":[{"href":"https:\/\/www.dhruvsoft.com\/blog\/wp-json\/wp\/v2\/posts\/366","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dhruvsoft.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dhruvsoft.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dhruvsoft.com\/blog\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dhruvsoft.com\/blog\/wp-json\/wp\/v2\/comments?post=366"}],"version-history":[{"count":0,"href":"https:\/\/www.dhruvsoft.com\/blog\/wp-json\/wp\/v2\/posts\/366\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dhruvsoft.com\/blog\/wp-json\/wp\/v2\/media?parent=366"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dhruvsoft.com\/blog\/wp-json\/wp\/v2\/categories?post=366"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dhruvsoft.com\/blog\/wp-json\/wp\/v2\/tags?post=366"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}