Mapping catalog task assignment group

Chethan S
Tera Contributor

There is catalog item named "Request Computer" in this catalog we have one field with different choices and based on the choice selected we need to map the task assignment group.

I have implemented using action using flow designer with below code

var gr = new GlideRecord('sc_req_item');
 gr.addQuery('number',inputs.number);
 gr.query();
 if(gr.next())
 {
    var topic = gr.variables.topic_dropdown;
    var cloud = gr.variables.cloud_provider;
    if(topic == 'test' || topic == 'test1'|| topic == 'test2' )
{
    var gr = new GlideRecord('sys_user_group');
    gr.addQuery('name','ENTERPRISE-CLOUD-OPS-TR');
    gr.query();
    if(gr.next())
    {
    outputs.sysid = gr.sys_id;
    }
}
As per the above code we are fetching choices from field for current Request and glide recording sys_user_group table to fetch sys_id of the group which need to be mapped.
 
is there any alternative approach to map catalog task assignment group based on choice selection in the form.
could anyone help me on this 
 
Regards
Chethan S
4 REPLIES 4

Swapna Abburi
Mega Sage
Mega Sage

Hi @Chethan S 

You are using "gr" twice in your script, can you use another variable object for group table query and try. 

Ankur Bawiskar
Tera Patron
Tera Patron

@Chethan S 

flow action is not required.

You can directly use a flow variable and write the logic using "Set Flow Variables" flow logic step and use inline script

Then use that flow variable to set the value on Assignment Group field

I will suggest to store the group sysId in system property and use it in the flow script.

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

@Chethan S 

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

AndersBGS
Tera Patron
Tera Patron

Hi @Chethan S ,

 

In general you can utilize a decision table instead of script. 

 

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/