- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2021 05:47 AM
Hi,
I have an action that returns a value . I want to call this action from a Script include. Is it possible to do?
Thanks in advance
Solved! Go to Solution.
- Labels:
-
flow designer

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2021 07:24 AM
Hello,
You can call the action from script include like this.
(function() {
try {
var grIncident = new GlideRecord('incident');
grIncident.get('57af7aec73d423002728660c4cf6a71c');
var inputs = {};
inputs['variable'] = grIncident;
var outputs = sn_fd.FlowAPI.executeActionQuick('global.update_record_test', inputs);
// Get Outputs:
// Note: outputs can only be retrieved when executing synchronously.
var output1 = outputs['output1'];
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();
Mark the comment as a correct answer and also helpful if this has answered the question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2021 05:55 AM
there is this function for calling the flow action -> executeAction
Refer below links
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2021 07:24 AM
Hello,
You can call the action from script include like this.
(function() {
try {
var grIncident = new GlideRecord('incident');
grIncident.get('57af7aec73d423002728660c4cf6a71c');
var inputs = {};
inputs['variable'] = grIncident;
var outputs = sn_fd.FlowAPI.executeActionQuick('global.update_record_test', inputs);
// Get Outputs:
// Note: outputs can only be retrieved when executing synchronously.
var output1 = outputs['output1'];
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();
Mark the comment as a correct answer and also helpful if this has answered the question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2023 09:46 AM - edited 09-28-2023 09:56 AM
@asifnoor hi
Do you know if it is possible to pass different connection and target host parameters to the `executeActionQuick` function call?
If I run this as a Test in Flow I see that metadata referred to, but not sure how I might pass that in.
My reason for asking is we are developing a scoped Store Application and considering that client organisations may want to limit the credentials that a ServiceNow user can use - the API Token in Jira seems to be "user specific" and use that users permissions. So two different projects in Jira may require two different API Tokens to access - and hence a credential (and possibly different target host) need to be selected and used on Spoke call.
Edit: Having posted this I found the API references - I notice two things:
1) That "executeActionQuick" is deprecated and "This API is replaced by ScriptableFlowRunner, which deprecates the existing methods used to build objects and execute Flow Designer flows and actions"
2) "ScriptableFlowRunner" has a method "withConnectionAliasOverride" - which may fit my requirement.
Thanks in advance
David