- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
I have noticed an issue post Yokohama release.
Simple custom actions that I built no longer work in flows.
The actions work, all logs are as expected when testing the action, but always fails in flows because the data pill (output from the action) seems empty - log messages go empty or undefined.
I was able to create custom actions with custom scripts before the Yokohama release.
Inputs
Script step
(function execute(inputs, outputs) {
// Log the entire inputs object for debugging
gs.log("Inputs: " + JSON.stringify(inputs));
// Check if table and field inputs are provided
if (!inputs.table || !inputs.field) {
throw new Error('Table and field inputs are required.');
}
// Retrieve the table sys_id and field from inputs
var tableSysId = inputs.table;
var field = inputs.field;
// Retrieve the table name using the sys_id
var tableRecord = new GlideRecord('sys_db_object');
if (!tableRecord.get(tableSysId)) {
throw new Error('Invalid table sys_id: ' + tableSysId);
}
var tableName = tableRecord.name;
// Log the table name for debugging
gs.log('Table name: ' + tableName);
// Retrieve the sys_id(s) from the lookup records action
var sysIds = inputs.sys_ids;
// Log the sys_ids for debugging
gs.log('sys_ids: ' + JSON.stringify(sysIds));
// Check if sysIds is defined and not empty
if (!sysIds) {
throw new Error('sys_ids input is required.');
}
// Split the sys_ids by new line or comma
var sysIdsArray = sysIds.split(/[\n,]+/);
// Log the sysIdsArray for debugging
gs.log('sysIdsArray: ' + JSON.stringify(sysIdsArray));
// Initialize an array to store the field values
var fieldValues = [];
// Iterate through each sys_id and retrieve the corresponding field value
sysIdsArray.forEach(function(sysId) {
var record = new GlideRecord(tableName);
if (record.get(sysId.trim())) {
var fieldValue = record.getValue(field);
gs.log('Field value for sys_id ' + sysId + ': ' + fieldValue);
fieldValues.push(fieldValue);
} else {
gs.log('Record not found for sys_id: ' + sysId);
}
});
// Log the field values for debugging
gs.log('Field values: ' + JSON.stringify(fieldValues));
// Set the output as an array of strings
outputs.field_values = fieldValues;
// Log the output for debugging
gs.log('Output field_values: ' + JSON.stringify(outputs.field_values));
})(inputs, outputs);
end of script step ----
I have also tried using Output type of array.string & array.object...
I opened a HI case but ServiceNow will not address because custom code is involved.
I guess that means ServiceNow allows but does not support custom actions used in Flow Designer.
Pretty crappy on ServiceNow's part if you ask me - they system is too rigid and returns data not helpful to humans, sys_id s as opposed to something identifiable by a human.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Flow designer post Yokohama displays empty data pills if the pill is the result of a custom action. The pills will work as expected when testing but will not work in a flow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Saturday
I look forward to the upcoming ability to debug custom scripted actions.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Oh, wait! It looks like you have "fieldValue" in some places and "fieldValues" (plural) in other places. If you fix those, does it work? Because your logic seems sound.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Can you share the flow execution screenshots when you call that action?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
all looks normal.
Can you share the flow execution screenshots when you call that 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
3 weeks ago
The value is populated as expected - but in flow always empty.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
in test run it works fine but not when it's called from Flow
It means input is not passed properly from Flow to Action.
sys_ids input is of type String, so from Flow you should pass comma separated sysIds
share the flow context screenshots when it actually calls the 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