Populate assignment group based on catalog item RITM by using Flow in Flow designer

NikhilKumaK
Tera Expert

Hi ServiceNow Devs,

 

I've a requirement to populate the assignment group based on catalog item RITM, all catalog items are using same variables.
But different assignment group is used for all catalog items. There are 18 catalog items RITM mapped to different assignment group, but variables populate are common for all catalog items.
How to approach by using flow in Flow designer?

Regards,

Nikhil

 

8 REPLIES 8

@NikhilKumaK 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

vignesh parthib
Tera Guru

Hi @NikhilKumaK 

you're looking to use Flow Designer in ServiceNow to:

  • Use an Update Record action on the sc_req_item (RITM) table.
  • Set the Assignment Group field.
  • Use an inline script to get the Assignment Group sys_id based on the Catalog Item name using a hardcoded mapping.

Please use blow script and also refer screen shot added:

 var catalogName = fd_data.trigger.request_item.cat_item.name;

    // Define mapping: catalog item name → assignment group name
    var mappings = [
        { catalog: "New Laptop Request", group: "IT Hardware Support" },
        { catalog: "VPN Access Request", group: "Network Team" },
        { catalog: "Software Installation", group: "Application Support" }
        // Add more as needed
    ];

    // Find the matching group name
    var groupName = '';
    for (var i = 0; i < mappings.length; i++) {
        if (mappings[i].catalog === catalogName) {
            groupName = mappings[i].group;
            break;
        }
    }

    // If group name found, query sys_user_group for the sys_id
    if (groupName) {
        var gr = new GlideRecord('sys_user_group');
        gr.addQuery('name', groupName);
        gr.setLimit(1);
        gr.query();
        if (gr.next()) {
            return gr.getUniqueValue(); // Return sys_id
        }
    }

    // Return empty string if no match found
    return '';image.png
Thanks,
Vignesh
If my answer solves your problem, please mark it as the correct answer.

Simran Gadodiya
Mega Sage

Hi @NikhilKumaK 

You can use if clause to check the item on RITM and based on this you can update the record through flow action to update the assignment group with code or pills.


Please let me know if it helps you. you can accept it as solution and mark it as helpful.

 

Thank You!!

Community Alums
Not applicable

@NikhilKumaK ,

To assign a group based on the catalog item from the RITM, you can use Flow Designer with inline script logic as others suggested. Another option you can explore is Assignment Rules. However, I believe the most feasible and scalable approach is using a Decision Table. It can be easily incorporated into a flow, reduces maintenance effort, and allows you to add or modify multiple conditions easily in the future. It’s also more readable for non-technical users, whereas heavy inline scripting can make the flow messy as conditions grow.