set assignment group

RoshaniB
Tera Expert

I want to set assignment group for request on the basis of type of request and location from workflow how do i do that.

7 REPLIES 7

Shraddha sawant
Tera Expert

@RoshaniB -

 

To implement dynamic assignment in a ServiceNow workflow based on Type and Location, you can use either the legacy Workflow Editor or the modern Flow Designer.

The "Best Practice" approach is to avoid hard-coding Sys_IDs in scripts and instead use a Decision Table or a Mapping Table.

 

Flow Designer (Recommended)

This is the most scalable way to handle routing without writing complex "if-else" code.

  1. Create a Decision Table: * Go to Decision Builder.

    • Create a table with two inputs: Request Type (Choice/String) and Location (Reference to cmn_location).

    • Set the result to Assignment Group (Reference to sys_user_group).

    • Add your rows (e.g., Type=Hardware + Location=London → Group=UK IT Support).

  2. In Flow Designer:

    • Add the action Make a Decision.

    • Map your catalog variables (Request Type and Location) to the decision inputs.

    • Use the output of this decision in your Create Catalog Task action under the "Assignment Group" field.

 

Ankur Bawiskar
Tera Patron
Tera Patron

@RoshaniB 

you can use workflow run script for this to set Assignment Group for REQ or RITM

something like this

var requestType = current.variables.requestTypeVariableName;

var location = current.variables.locationVariableName;

if (requestType == 'your value' && location == 'abcd') {
    current.assignment_group = 'groupSysId1';


    // if you wish to set for REQ then use below code

    var req = current.request.getRefRecord();
    req.assignment_group = 'groupSysId1';
    req.update();
}

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

If I want to set assignment group for RITM and Task from workflow, on the basis of only  type of request and then based on type request + location with updated short description is it possible from workflow its all in one request.

Hi @RoshaniB ,

Yes I think it can all be handled in one Script .but you have to make changes to above script shared as per your use-case. From the single script you can read the request type and location, set the assignment group on the RITM, and also update the Catalog Tasks (and short description) in the same script.

 

Thanks and Regards,

Mohammed Zakir