Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Seeking advice on auto-populate assignment group based on HTML field

Thant1
Tera Contributor

Seeking advice on auto-populate assignment group in RITM based on the keyword that user has entered in the html field of catalog item form. Please share with me any possible ways to get it done. 

 

Thanks!

 

 

3 REPLIES 3

Paul Kunze
Tera Guru

Hi, you can create a Catalog Client Script which searches for the keyword in the HTML payload. It can be an easy string operation like g_form.getValue('html_field').includes(keyword).

Then you can assign the correct assignment group based on your conditions using g_form.setValue('group', approvalGroup).

 

Ankur Bawiskar
Tera Patron
Tera Patron

@Thant1 

3 approaches

1) Approach 1: you can use after insert business rule on sc_req_item table

Condition: current.cat_item.name == 'Your Item Name Here'

Search for the keyword in that HTML variable and then set the group

something like this but please enhance

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

    // Add your code here
    if (current.variables.variableName.indexOf('keyword1') > -1) {
        current.assignment_group = 'groupSysId1';
        current.setWorkflow(false);
        current.update();
    }

})(current, previous);

OR

2) Approach 2: If you are using Flow for your catalog item then you can handle this using "Get Catalog Variables" and "Update Record" flow action

see this link for help which talks about Setting it for Catalog Task but you can enhance it for RITM

Flow Designer to set assignment group based on variable value dynamically 

OR

3) Approach 3: If you are using Workflow for your catalog item then you can use Run Script activity in workflow

 if (current.variables.variableName.indexOf('keyword1') > -1) {
        current.assignment_group = 'groupSysId1';
    }

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

@Thant1 

Hope you are doing good.

Did my reply answer your question?

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