- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 05:40 AM
I am trying to use the "Microsoft Active Directory v2 Spoke" in Flow Designer to add/remove people from AD groups. On my Catalog Item, I have a List Collector field where they can select all the groups that they want to be added to/removed from. I have then built a Custom Action that loops through my List Collector, and builds a string of all the AD Codes that they need to be added to, separated by commas. So the output is a comma separated string.
If I go out to Flow Designer, go into the "Microsoft Active Directory v2 Spoke" and choose the "Add User to Groups" Action, there is an argument for Group Names that looks like this:
If I try to "drag-and-drop" the data pill from the output of my Custom Action, I get an error message that says "String is not allowed here". I am not sure how to convert my output string from my Custom Action into an "array.string". That doesn't even look like a valid data type I can use in my variables!
What do I have to do to get my output into an "array.string" field type so I can use it in this Group Names field?
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 09:03 AM
OK, I think I got it figured out now.
In the Script step part of my Custom Action, I need to set-up an output variable that is of "Array.String" type, i.e.
Then, in my Script portion, to first set up an array field in the script like so:
var codes = [];
and then populate it with array values as I loop through my GlideRecord:
while(gr.next()){
codes.push(gr.field_name));
}
outputs.output_array = codes.toString();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 06:22 AM
I haven't used this one specifically, but my first thought would be to use the script, and do something like
return fd_data.flow_variables.variable_name.split(",");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 07:24 AM
Thanks. That got me on the right track. I had to do that, and also make BOTH the variable in the Output part of the script an "array.string", as well as the Output field for the Custom Action (make it "array.string").
When I did that in conjunction with your suggestion, it allowed me to add that field to the "Group Names" box.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 07:32 AM
Check that. It looks like it didn't quite work. It accepted the variable/field in that Action, but it is passing an empty array, so is obviously not having the desired effect. Maybe I need to approach this differently, and have it create and populate an array right from the start in my script, instead of trying to convert a string to an array at the end.
I will play around with it more and do some testing and post back.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 09:03 AM
OK, I think I got it figured out now.
In the Script step part of my Custom Action, I need to set-up an output variable that is of "Array.String" type, i.e.
Then, in my Script portion, to first set up an array field in the script like so:
var codes = [];
and then populate it with array values as I loop through my GlideRecord:
while(gr.next()){
codes.push(gr.field_name));
}
outputs.output_array = codes.toString();