Flow action tests perfectly on it's own but data pill seems empty in flow. Any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2025 08:23 AM - edited 07-25-2025 08:53 AM
I have a custom action for Flow designer that has a successful test as expected.
But when the action is added to a flow, the data pill seems to return as empty.
`Tested with simple scripts to ensure the output host_names populates as expected.
`Tested with the exact raw text from step to ensure sys_id s is read correctly.
The gs.info("host names: " + outputs.host_names); creates a log message as expected when run as action
but when run in flow the gs.info("host names: " + outputs.host_names); creates a log message with only host names:
The output is a string, I have tested with & without mandatory selected.
The output is mentioned below the script step & in the Output area.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2025 12:39 PM
Hi @LonLandry1 ,
There is likely an issue with the configuration of the outputs OR Flow Designer behavior. I'd recommend reading through this Developer Article on Adding Action Outputs to ensure that the outputs are full configured.
The next thing I would check is if you have published the action. Then, in the Flow, remove the action, save, refresh the page, and try adding the action again. Flow Designer does not automatically pull in changes to custom actions, so the flow might be referencing an earlier version of the action.
If neither of these help in troubleshooting, please do also post screen shots of your action's outputs sections (both the outputs below the script step, and the outputs section) so that we can troubleshoot further.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2025 06:13 AM
I tried removing (good idea), but still not working as expected.
I think I may try a new custom action first, if that fails, I will update with screen shots.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2025 06:21 AM
what's the action input type?
share some screenshots.
If it's work as standalone but not from flow then some issue in passing the input to flow action.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2025 06:56 AM
In the script he actual filed names are correct - verified when tested as an action.
Script
(function execute(inputs, outputs) {
// Convert the input string of sys_ids (assumed to be newline-separated) into a clean array
// - .split(/\r?\n/) handles both Unix and Windows newlines
// - .map(...trim) removes extra whitespace
// - .filter(...) removes any empty strings
var sysIdArray = inputs.sys_ids.split(/\r?\n/).map(function(id) {
return id.trim();
}).filter(function(id) {
return id !== '';
});
// Initialize an array to store unique host names
var hostNames = [];
// Create an object to track seen host names to ensure uniqueness
var seen = {};
// Query the 'u_someapp_host_import' table for records matching the provided sys_ids
var gr = new GlideRecord('u_someapp_host_import');
gr.addQuery('sys_id', 'IN', sysIdArray.join(','));
gr.query();
// Loop through the returned records
while (gr.next()) {
// Get the host/application name from the current record
var hostName = gr.getValue('u_application_name');
// If this host name hasn't been encountered yet, add it to the result
if (!seen[hostName]) {
seen[hostName] = true; // Mark as seen
hostNames.push(hostName); // Add to output list
}
}
// Output the unique host names as a comma-separated string
outputs.host_names = hostNames.join(', ');
// Log the result for debugging purposes
gs.info("host names: " + outputs.host_names);
})(inputs, outputs);