Flow Designer variables

cgedney
Giga Guru

I am trying to build an inbound email flow designer. What I need to be able to do is add a group of users to the watchlist on the incident form. What I tried to do originally was do a lookup of the group and then do a for each item and assign that to a variable. I cannot find a way to assign the values to a variable recursively so that they become a comma separated list. So then I tried to build a sub flow and assign the values to the output variable, but it doesn't allow you to attach the values in a list to the output variable. Any help is much appreciated.

find_real_file.png

find_real_file.png

1 ACCEPTED SOLUTION

Ashutosh Munot1
Kilo Patron
Kilo Patron

HI,

I have created a custom action which can be used in all tables as below:

1) Inputs:

Group Name : name of group so that users for this group can go to watchlist

Table Name: Table name

Table Sys Id: Where the watch list has to be updated.

 

2) Script:

(function execute(inputs, outputs) {
// ... code ...
  var inc = new GlideRecord(inputs.tableName);
  inc.addQuery('sys_id',inputs.tableSysId);
  inc.addActiveQuery();
  inc.query();
  if(inc.next()){
    var arr = [];
  	var grp = new GlideRecord('sys_user_grmember');
    grp.addQuery('group.name',inputs.groupname);
    grp.query();
    while(grp.next()){
    	arr.push(grp.user+'');
    }
    inc.watch_list = arr.toString();
    inc.update();
  }
  outputs.ids = arr.toString();
  
})(inputs, outputs);

 

3) Outputs:

 

 

Tested Result:

 

 

Attached is the xml of the Action:

 

Thnks,
Ashutosh

View solution in original post

5 REPLIES 5

Neal3
Tera Contributor

I know this is an older post but I want to thank Ashutosh who helped me get things working in the right direction for me with my requirements.

I had a slightly different set of requirements and now on Quebec so figured I would share if this helps anyone else.

By adding an action (no scripting) to my flow that handles both names from a property and names already in the ticket this opens up the ability to have custom properties handled by ITIL level users.

Here is what I did:

In the inputs you can see we are taking in a field list, this is the result of pulling in a comma list of names from a system property, this can be a string in the property but must be a list here. The second part is just linked in your flow by dropping in the current ticket watch list pill. 

find_real_file.png

Next we look up the users for both variables by using an "OR" filter, but one is set to name and the other is set as a sys_id lookup.  Be sure to set these as I did here.

 

find_real_file.png

 

Lastly the output needs to be a string, it gets incapsulated as an object list within the pill but it's still a string.

find_real_file.png