I do a bit of Admin/Dev work in Salesforce and tend to lurk into the dark corners of the force.com platform here and there. Very often, when tackling a request fulfilment, I encounter a non-standard, hard to fulfil jobs. Even with helpful community around SalesForceDotCom, as well as many other blogs and resources, sometimes it is hard to find your specific case and a solution.
This quick tip and solution is for people that use Service Cloud and Cases object in Salesforce.com
Request: When I create new case, I’d like to select owner before I save it, so I don’t have to do extra work and assign it to target AFTER case is saved (Salesforce does not allow you to change owner during the case editing details, for some probably valid reasons and to preserve stability of the platform).
Options: Assignment Rules in Salesforce cover a lot of these scenarios, but… I am a guy who really hates Workflow/Rules limits and tries to be future proof, so I use Process Builder whenever I can replace Workflow Rules. This quick tutorial is exactly for Process Builder Auto Assign scenario with selectable option even when case is created.
NOTE: While it is nice to work with Queues and Teams, you probably don’t want it to serve assignment to individual user (about that, later).
We are working Teams/Queues here.
Let’s assume we have 6 teams with their queues – Sales, Product, Management, Operations, Support and Accounts.
CUSTOM FIELD SETUP
In order to make things happen we need to first create new custom field for the selection process.
- Go to Setup>Build>Customise>Cases>Fields
- Create new custom field of type PICKLIST (NOT a multi-select, just standard picklist).
- Name it whatever you want and make sure you don’t use global piclist but change it to “Enter values, with each value separated by a new line”
- Populate the white text area with your values, separated, one per line using line breaks (ENTER)
- Select audience and accessibility on the next screen
- Select relevant Case Type layout where you want to put it and save
Once we have the field on a case layout, we’re giving the user ability to select Team/Queue at the time of case creation, before it even exists in Salesforce… but it’s just a selection doing nothing at the moment, so let’s polish it up and put the cherry on top, with a Process Builder.
CASE RECORD TYPE NAME
Before we head into Process Builder, we need some values, noted aside.
If you have only one record type for cases, skip this step and go to “Queues and their IDs”.
First go to the Setup>Build>Customise>Cases>Record Types and find the Case Type of your choice. Click on its name and you should be able to find the “Record Type Name” – take note of it.
QUEUES AND THEIR IDs
- Go to Setup>Administer>Manage Users>Queues
- Click on each and every queue that you listed on Custom Field Creation and look up its URI in the browser – you should be able to locate each queue unique 15 characters ID. It is usually a number with letter, case sensitive, between ?id= and &type
- Note relevant ID for each corresponding queue
BUILDING THE PROCESS
- Go to Setup>Create>Workflow & Approvals>Process Builder
- Create new process and name it as you wish (I named mine “Auto-Assign to Queue on save”)
- Entity we use will be the CASE object and the process should start “when a record is created or edited”, in addition you can expand “Advanced” and select “Yes” for recursion – this will make it bulletproof against other trigger/process holding it in a single transaction and repeat it up to 5 times to ensure it goes through – this option is not widely recommended but we’ll be only updating the field here so this bears no duplication risk etc. Make sure you SAVE it at the bottom!
Now it’s time to set the first criteria and repeat them with a small change for every Queue on the list.
Add Criteria and name it whatever you wish, but something reasonable like “Sales Queue Selection”
Make sure that “Criteria for Executing Actions” is set to “Conditions are met”
IF YOU HAVE SINGLE CASE RECORD TYPE SKIP THE FIRST CONDITION AND CREATE ONLY SECOND CONDITION FOR EACH QUEUE
Set first condition to be “Record Type > Record Type Name” [Equals] [String] and type in the case “Record Type Name” noted before.
Set Second condition to be your Custom Field Value [Equals] [Picklist] and then select first Queue that you want to apply process to. SAVE AS IS.
You can now either repeat the process and add them all and then test, or you can activate single Queue process and test it immediately. It is up to you but remember that once process is okay, you can’t modify it after activation, so you have to clone it, make amendments/additions in the new iteration and then activate this iteration as the current process.
A bit chaotic but whoever dealt with SFDC shall be quite familiar with all that I wrote and recognise what and where. Hope it saves somebody’s headache someday as it did to me. I may add some pictures later…