Help Needed: Auto-Populate Assignment Group Based on Category in Incident Form

saifulya01
Tera Contributor

Hi everyone,

I'm working on optimizing our Incident Management process and need some help with a use case I'm trying to implement.

Use Case:
When a user selects a specific Category on the Incident form (e.g., "Network", "Hardware", "Software"), I want the Assignment Group field to automatically populate with the appropriate group (e.g., "Network Team", "Desktop Support", etc.).

What I've Tried:

I attempted using a Client Script (onChange) for the Category field.

I also looked into UI Policies, but couldn't get the dynamic value mapping to work as expected.

There’s a possibility I may need a Data Lookup Definition, but I’m not sure if that’s the right route.

Questions:

What's the best approach to implement this?

Can this be done purely through configuration, or is scripting required?

Any best practices to ensure this works across different user roles and forms (e.g., Service Portal)?

Thanks in advance for any guidance you can provide!

6 REPLIES 6

graham_c
Tera Guru

There are a couple different ways depending on how much control you want to allow the user.

 

 - Client Script (onChange) of Category field - this would allow the assignment group to be set before saved on the record, so the user could change the value if they disagree and want it assigned to another team. This may require further setup though as to avoid hardcoded group sys_ids in the script you would need to create properties for each category group to store the sys_ids and look up in the script to set the value. 

 

 - Business Rule - This is done when the user saves the record, forcing the assignment group data to be set based on the rules. You can do this without scripting using the condition and action tabs to set the value. This will prevent the user from being able to set the assignment group to something else as it will force it when meeting the condition.

 

UI Policy is not fit for purpose here and data lookup definitions feels like overkill

AndersBGS
Tera Patron
Tera Patron

Hi @saifulya01 ,

 

Have you though about assignment data lookup rule: https://www.servicenow.com/docs/bundle/yokohama-platform-administration/page/administer/task-table/t...

 

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

Roshnee Dash
Tera Guru
Hi @saifulya01 
try once like this.
  1. Create a Script Include
    • Make sure to create a Script Include in ServiceNow with the following logic:
var IncidentAssignmentHelper = Class.create();
IncidentAssignmentHelper.prototype = {
    initialize: function() {},

    getAssignmentGroup: function(category) {
        var categoryGroupMap = {
            "Network": "Network Team",
            "Hardware": "Desktop Support",
            "Software": "Application Support"
        };

        return categoryGroupMap[category] || "";
    },

    type: 'IncidentAssignmentHelper'
};
  • Ensure the Script Include is client-callable/GlideAjax Callable so the Client Script can access it.
  •  
  • Client Script (onChange)

    • Now, modify your Client Script to use GlideAjax:
(function executeRule(current, gForm, gSNC) {
    // Get the selected category
    var selectedCategory = gForm.getValue("category");

    // Call the Script Include via GlideAjax
    var ga = new GlideAjax('IncidentAssignmentHelper');
    ga.addParam('sysparm_name', 'getAssignmentGroup');
    ga.addParam('sysparm_category', selectedCategory);
    ga.getXMLAnswer(function(response) {
        if (response) {
            gForm.setValue("assignment_group", response);
        } else {
            gForm.clearValue("assignment_group"); // Clear if no match
        }
    });
})(current, gForm, gSNC);

This code is just a example. You can change the name and value based on your logic if its not matching.

Your feedback makes the community stronger! If you found this helpful, marking it as the correct answer helps others.
Stay awesome,
Roshnee Dash

Hi @saifulya01 
If this step resolves the issue, could you mark it as "Accept as Solution" and close the thread?

Your feedback makes the community stronger! If you found this helpful, marking it as the correct answer helps others.
Stay awesome,
Roshnee Dash