Some PDIs are currently unavailable, and PDI actions are paused. View the latest updates here. Read More

Set RITM Assignment Group Based on Selected Checkbox Variable

tilekarnilesh
Tera Guru

Hi Community,

I have a catalog item with multiple checkbox variables. Based on the checkbox selected by the user, I need to set the RITM Assignment Group to the corresponding group.


For example:

Checkbox variable Expected RITM Assignment Group
abc ABC_Group
bcd BCD_Group
cde CDE_Group
def DEF_Group
efg EFG_Group
fgh FGH_Group

There is also a Partner variable. If Partner = Others, separate assignment logic is already in place, so this Business Rule should only execute when Partner is not Others.

The related SCTASKs are being created correctly and their assignment groups are also being populated correctly based on the selected checkbox.

The issue is with the RITM assignment group.

For example:

Checkbox abc = true
→ SCTASK is correctly assigned to ABC_Group
→ RITM should also be assigned to ABC_Group

I tried a Before Insert Business Rule on sc_req_item with the following script:

(function executeRule(current, previous) {

var partner = current.variables.partner + '';

// Do not handle Others
if (partner == 'Others') {
return;
}

var abc = current.variables.abc + '';
var bcd = current.variables.bcd + '';
var cde = current.variables.cde + '';
var def = current.variables.def + '';
var efg = current.variables.efg + '';
var fgh = current.variables.fgh + '';


// ABC
if (abc == 'true') {
current.setValue(
'assignment_group',
'ABC_GROUP_SYS_ID'
);
return;
}

// BCD
if (bcd == 'true') {
current.setValue(
'assignment_group',
'BCD_GROUP_SYS_ID'
);
return;
}

// CDE
if (cde == 'true') {
current.setValue(
'assignment_group',
'CDE_GROUP_SYS_ID'
);
return;
}

// DEF
if (def == 'true') {
current.setValue(
'assignment_group',
'DEF_GROUP_SYS_ID'
);
return;
}

// EFG
if (efg == 'true') {
current.setValue(
'assignment_group',
'EFG_GROUP_SYS_ID'
);
return;
}

// FGH
if (fgh == 'true') {
current.setValue(
'assignment_group',
'FGH_GROUP_SYS_ID'
);
}

})(current, previous);

The Business Rule configuration is:

Table: Requested Item [sc_req_item]
When: Before
Insert: True
Update: False


What would be the recommended approach to set the RITM assignment group based on the selected checkbox after catalog submission?

Is a Business Rule the correct approach, or should this assignment be handled through the Flow/Workflow after the variables and RITM are fully available?

Any suggestions would be appreciated.

8 REPLIES 8

Hello @Ankur Bawiskar ,

There is a standard flow for all catalog items. It creates a task in a custom table and populates the basic details based on the catalog variable conditions. That’s why I’m trying to implement this through a Business Rule.

If you have any articles or documentation regarding Decision Tables that could help with this requirement, that would be helpful for me.

@tilekarnilesh 

I don't think in before insert BR on RITM table you will have access to the variable value

For decision table check this

How to use Decision Tables in Flow for approval routing on Requested Item based on variable values d... 

How to use a Decision Table in a flow with catalog item variables? 

💡 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  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Tanushree Maiti
Tera Patron

Hi @tilekarnilesh 

 

You can try this:

 

To set the RITM assignment group using a Business Rule, use a Before Insert/Update rule on the Requested Item (sc_req_item) table.

 

  • Table: Requested Item (sc_req_item)
  • When: Before (Insert and Update)
  • Condition: current.variables.partner != 'Others'

 

(function executeRule(current, previous /*null when async*/) {

   

    // if (current.cat_item == 'YOUR_CATALOG_ITEM_SYS_ID')  // Ensure it runs only for the specific catalog item if needed

  // {

   

    var partner = current.variables.partner ;

   

    if (partner !== 'Others') {

       

        if (current.variables.abc == 'true') {

            current.assignment_group = 'ABC_Group'; // Use Group Name or Sys ID

        } else if (current.variables.bcd == 'true') {

            current.assignment_group = 'BCD_Group';

        } else if (current.variables.cde == 'true') {

            current.assignment_group = 'CDE_Group';

        } else if (current.variables.def == 'true') {

            current.assignment_group = 'DEF_Group';

        } else if (current.variables.efg == 'true') {

            current.assignment_group = 'EFG_Group';

        } else if (current.variables.fgh == 'true') {

            current.assignment_group = 'FGH_Group';

        }

    }

//}

})(current, previous);

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

Hello @Tanushree Maiti 

thanks will try..