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.

How to populate assignment group using Flow Designer f(x) script?

Erica2
Tera Contributor

Hi,

I need help on how to populate assignment group based on user select dropdown variable value that contains pacific word using Flow Designer f(x) script.

This is what I have, but it did not work.  Can someone please provide suggestion.  Thank you

find_real_file.png

1 ACCEPTED SOLUTION

-O-
Kilo Patron

If using Flow anyway, why not use Decision Tables? You can then create a completely code free solution.

Define the decision table that accepts a text input to use in the condition:

find_real_file.png

AAnd the condition:

find_real_file.pngThen use it in the flow:

find_real_file.png

Using a Catalog Item variable as below:

find_real_file.png

And finally update the assignment group:

find_real_file.png

View solution in original post

25 REPLIES 25

OlaN
Giga Sage
Giga Sage

Hi.

Assignment group is a reference, so if you want to populate it with a valid value, you'll need to return a sys_ID, not the name of the group from your script.

Erica2
Tera Contributor

Hi,

How do I modify the following code to make it works.  Thanks

var av ='';
var TeamName = 'Outlook App';

 

if(TeamName.indexOf('Outlook') ==-1){
av += 'IT Service Desk Team';
}
return av;

You could try something like the following:

var av ='';
var groupSysID = '';
var TeamName = 'Outlook App';

if(TeamName.indexOf('Outlook') == -1){
  av = 'IT Service Desk Team';
  var assignGR = new GlideRecord('sys_user_group');
  assignGR.addQuery('name', av);
  assigneGR.query();

  if (assignGR.next()){
    groupSysID = assignGR.getUniqueValue();
  }

}
return groupSysID;

Erica2
Tera Contributor

Hi OlaN,

I have tried your suggestion and it works. However, it is not populate the value inside the Assignment group field.  Instead is shows up as a dropdown list.  End user needs to select from it. 

 

find_real_file.png

-O-
Kilo Patron

If using Flow anyway, why not use Decision Tables? You can then create a completely code free solution.

Define the decision table that accepts a text input to use in the condition:

find_real_file.png

AAnd the condition:

find_real_file.pngThen use it in the flow:

find_real_file.png

Using a Catalog Item variable as below:

find_real_file.png

And finally update the assignment group:

find_real_file.png