
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2023 08:47 AM
Hi Guys
I have an issue with Flow Designer where by I created an action within a flow.
I know the Action is receiving the correct input values as they show on the Step Configuration when I test:
I know that in my Action the script is working and producing the outputs that I need when I test the action
But what is not working is that when I run the test on the overall flow (which is meant to use the output values to send an email) the flow execution reads that the "Email has no recipients".
When I look at the outputs in the flow execution for my action, in this instance there are no outputs:
Can anyone point me in the right direction as to why the Action will display correct info when I test the action but when I test the overall flow that the action is in, then the Outputs cannot be retrieved?
Kind Regards
Markell
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2023 08:14 AM - edited 03-06-2023 08:15 AM
Hi Guys so got this sorted with SN Support. They advised that the issue doesn't seem to be a problem with the input data, but does appear to be a known new bug, discovered recently on a previous case, and referred me to this knowledge article.
The fix was to change part of my code to retrieve the input value from:
var value = inputs.request_item;
grReq.addQuery('sys_id',value.);
to
grReq.addQuery('sys_id',value.getUniqueValue());
"It seems to be an issue how the Reference is passed to the subflow as input."
Posting this in the hope it helps someone else in future as I did not know you had to use getUniqueValue() to get the sys_id to pass the value in a flow (and that this was a previously known issue).
Regards
Markell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2023 09:13 AM
You can see the scope and the accessibility if you click the three dots in the top-right of your action anc choose properties. You should see something like this:
What about the other thing I have mentioned - how is the flow run? The same way I mentioned above for Action properties, you can check the properties of the Flow and verify if 'Run As' is set to 'System User' or 'User who initiates the session'.
It's hard to think of anything else without seeing the actual flow and the actions. If everything is in order, it is usually just a data mapping issues, especially if your Action is working when tested separately.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2023 06:14 AM
My Action(s) Inputs:
Script:
(function execute(inputs, outputs) {
var value = inputs.request_item;
var grReq = new GlideRecord('sc_req_item');
grReq.addQuery('sys_id',value);
grReq.query();
if(grReq.next()){
var RSassigned = '';
outputs.ritm = grReq.getValue('number');
var ritm = grReq.getValue('number');
//**** gr get values from task----//
var grTask = new GlideRecord('sc_task');
grTask.addQuery('request_item',value);
grTask.addQuery('state','1').addOrCondition('state','-5').addOrCondition('state','2');
grTask.addQuery('active','true');
grTask.query();
if(grTask.next()){
if(grTask.assigned_to != ''){
RSassigned = '1';
} //***3
if(grTask.assignment_group != ''){
RSassigned = '2';
} //***4
if(RSassigned == '1'){
var grUsers = new GlideRecord('sys_user');
grUsers.addQuery('sys_id',grTask.assigned_to);
grUsers.query();
if(grUsers.next()){
outputs.assigned_to = grUsers.getValue('name');
outputs.email = grUsers.getValue('email');
}
}
if(RSassigned == '2'){
var grGroups = new GlideRecord('sys_user_group');
grGroups.addQuery('sys_id',grTask.assignment_group);
grGroups.query();
if(grGroups.next()){
outputs.assigned_to = grGroups.getValue('name');
outputs.email = grGroups.getValue('email');
}
}
}
//**** gr get values from approval----//
var grAppRec = new GlideRecord('sysapproval_approver');
grAppRec.addQuery('sysapproval.number',ritm);
grAppRec.addQuery('u_active','true');
grAppRec.addQuery('state','requested');
grAppRec.orderBy('sys_created_on');
grAppRec.query();
if(grAppRec.next()){
RSassigned = '3';
if(RSassigned == '3'){
var grAppUser = new GlideRecord('sys_user');
grAppUser.addQuery('sys_id',grAppRec.approver);
grAppUser.query();
if(grAppUser.next()){
outputs.assigned_to = grAppUser.getValue('name');
outputs.email = grAppUser.getValue('email');
}
}
}
}
})(inputs, outputs);
Output variables:
Action Outputs
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2023 04:24 PM
grAppRec.addQuery('sysapproval.number',ritm); may be ignored by GlideRecord due to there not being a ".number". When part of a GR is in error, GR ignores it. It could be always running RSassigned==3

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2023 03:30 AM
Thanks for response.
If it was caused by such an error, why would the initial test in the action work (retrieve a value)?
Would seem odd. I do use that glide on the approval table allot as it took me a while to figure out how to get that field to work in a gliderecord
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2023 03:58 AM
An invalid addQuery, is ignored. The GR query will continue like it doesn't exist. You'll still get results, just a lot more.
Remember that you can dot walk.
grTask.assigned_to.name.toString() == grGroups.getValue('name');