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
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

@Harshvardhan 

I retest the flow and only one log returned.  The 'Value inside if' did not executed. This is very good to know how to troubleshooting script.  Any suggestion on how to fix it.   Thanks

find_real_file.png

Just confirming here, everything you have hardcoded here so why you need script ? 

If i see your script , TeamName variable holding hardcoded value 'Outlook App'

so why you need script ?

 

 

 

 

var av ='';
var TeamName = 'Outlook App';
 
gs.log('index of check '+ TeamName.indexOf('Outlook'));
if(TeamName.indexOf('Outlook') > -1){
gs.log('Value inside if ');
av += 'IT Service Desk Team';
}
return av;

use below line and see if it went to if block or not

 

if(TeamName.indexOf('Outlook') > -1){

@Harshvardhan 

I have also tried your suggestion code and it works as well, but it populated the value as a dropdown list instead. Is is not showing the value inside the Assignment Group field. End users needs to select the value from the dropdown list.

 

find_real_file.png

Voona Rohila
Kilo Patron
Kilo Patron

Hi Erica

use != operator 

Reference links:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Strict_inequality

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP