- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2024 07:59 PM
I created a subflow so that I could call it in a legacy workflow. All it does it query whether a user is a member of an AD group. When I call it in a workflow using a script activity it returns true. Yet when I call it from a background script or directly from flow designer with the same inputs I get false which is what I am expecting because the user is not in the AD group.
********Background Script*************
var inputs = {};
inputs['user'] = 'secyorkb'; // String
inputs['group'] = 'SN.03 Test Related App - SOC1'; // String
// Execute Synchronously: Run in foreground. Code snippet has access to outputs.
var result = sn_fd.FlowAPI.getRunner().subflow('global.is_user_in_group').inForeground().withInputs(inputs).run();
var outputs = result.getOutputs();
// Get Outputs:
// Note: outputs can only be retrieved when executing synchronously.
var is_member = outputs['is_member']; // True/False
gs.addInfoMessage('XX: outputs ' + is_member); ----> This returns false
************Subflow***************
***********Workflow Script Activity*************
I hard coded the values to make sure it would definitely use the same data
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 06:13 AM
It turns out that though I was passing in a string to function it was treating it as an object for some reason. Once I added .toString() it works fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2024 09:49 PM
Instead of putting 2 mins wait activity, try keeping the wait time in the script itself just after calling subflow.
Using gs.sleep(milliseconds). Not a best Practice but you can still try to see if it's a synchronous issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 06:13 AM
It turns out that though I was passing in a string to function it was treating it as an object for some reason. Once I added .toString() it works fine.