Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Assignment Rules condition for catalog variables in variable set

_hris A
Tera Expert

I have requirements to use assignment rules with a catalog variable that is in a variable set. 

 

I can make make the condition for the assignment rules work for the catalog variables, but when I attempt to use the variable set variables, it gets erased before save. 

 

What am I doing this incorrectly?

1 ACCEPTED SOLUTION

Hi @_hris A ,

 

it is possible to add variable of catalog as well as Single row variable sets variables in the condition

it's not possible to add the MVRS variables in the condition builder

ChaitanyaILCR_0-1750679357957.png

you can use script as for assignment

ChaitanyaILCR_1-1750679400125.png

something like this

var variableValue = current.request_item.variables.yourVarialbename
gs.warn('catalog task variable assignment '+variableValue )

if(variableValue  =='10'){
current.assignment_group = 'your assignment group sysid'

}

 

 

but again it's better set the assignment group in the flow or workflow whichever is used to create the task

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

View solution in original post

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

@_hris A 

It got saved for me and didn't clear after saving.

I will suggest to use before insert business rule if your assignment rule is not allowing you to configure.

AnkurBawiskar_0-1750680206330.png

 

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

Nitish Saini
Giga Guru

You're trying to use variables from a variable set in an Assignment Rule, but:

  • The condition editor recognizes the variable initially.

  • After saving, the condition referencing the variable gets erased.

  • This is due to how catalog variables (especially those in variable sets) are stored in the sc_item_option_mtom table, not directly on the sc_req_item (RITM) or catalog task (e.g., sc_task) record. Assignment rules operate directly on task tables and can't access catalog variables stored this way without custom logic.

    Please use a below script condition in your assignment rule to pull catalog variable values via script rather than the UI condition builder.

    (function executeRule(current, gSNC) {
    var variableValue = getVariable(current.request_item, 'your_variable_name');
    return variableValue == 'desired_value';

     


    function getVariable(item, variableName) {
    var varGR = new GlideRecord('sc_item_option_mtom');
    varGR.addQuery('request_item', item);
    varGR.query();
    while (varGR.next()) {
    var itemOption = varGR.sc_item_option;
    itemOption.refresh(); // load the related sc_item_option record
    if (itemOption.getDisplayValue('item_option_new') == variableName) {
    return itemOption.getDisplayValue('value');
    }
    }
    return null;
    }
    })(current, gSNC);

    Please Replace 'your_variable_name' with the name of the catalog variable.

    Please mark my answer as helpful/correct if it resolves your query.

    Regards,
    Nitish Kr. Saini