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.

2 REPLIES 2

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