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.

flow designer script the assignment group based on a catalog variable chosen

Community Alums
Not applicable

for 'Create Catalog Task' action in my flow, I have scripted the Assignment Group as one that has a name that starts with 'CLD - Saas' and contains the name of the product variable: 

var ag = fd_data.trigger.current.assignment_group;
var product = fd_data.trigger.current.variables.product;

var group = new GlideRecord('sys_user_group'); 
group.addEncodedQuery('nameSTARTSWITHCLD - SaaS^nameLIKE' + product); 
group.query(); 
if (group.next()) { 
    ag = group;
}
return ag;

but when I try to activate the flow it gives me an error about not being able to use 'current'. 

What am I doing wrong? 

13 REPLIES 13

OlaN
Tera Sage
Tera Sage

Hi,

I would recommend looking into Decision builder instead of scripting a value what group should be selected, then you can use the Flow action "Make a decision".

Look at this video if you're interrested.

Community Alums
Not applicable

I'd love to try this but PDIs don't allow Store installs so I can't use the decision builder they used. I tried building a decision table manually without Decision Builder but I'm so lost and can't figure out how to get the variables from my specific catalog item. 

Community Alums
Not applicable

The list of products on the catalog form is a choice list and has a bunch of options, two of which are 

-banner

-analytics

 

I created a decision table that has these things: 

  • answer table: sys_user_group
  • inputs:
    • reference to the variable table | name: u_item
    • reference to sc_req_item | name: u_req_item
  • decisions: 
    • condition: u_item.variable_name=banner  | answer: banner group
    • condition: u_item.variable_name=analytics | answer: analytics group

Then added the decision to the flow: 

find_real_file.png

and a catalog task to use the Group Record from the result of the decision 

find_real_file.png

however, the group doesn't get assigned and in the description the sys_id of the group is blank 

find_real_file.png

find_real_file.png

So it seems like something is wrong with the decision you've created.

I don't have much or good experience with the original decision table/UI, I think it's a bit confusing, so i really can't help you much more there.