
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2023 04:20 PM
Hi,
Does anyone know how to use GlideFlow in Workspace Client Script? If it's not possible, what is the alternative to leverage modern capabilities for a basic use case of invoking a Flow Designer Action from a Button on the new Workspaces?
The error being received is "SCRIPT:EXEC Error while running Client Script "GlideScopedScript": ReferenceError: GlideFlow is not defined"
I'm just doing something like this in "Workspace Client Script":
GlideFlow.startAction('global.myAction', inputs)
.then(function(execution) {
return execution.awaitCompletion();
}, errorResolver)
.then(function(completion) {
var status = completion.status;
// Available Outputs:
var outputs = completion.outputs;
g_form.save();
}, errorResolver());
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2023 07:53 AM
Hello @KB1
I assume with the “Workspace Client Script” you mean the script field in a UI Action for Workspace as shown in the following Screenshot:
I double checked, and while calling the Flow action from the “UI16” client-side UI Action is working, it is not supported by the “Workspace Client Script” (shown in the screenshot). I have implemented this logic multiple times in the past, calling it from the “UI16” backend UI Actions.
However, I quickly created a working example that is calling a Flow Designer Action from a “Button on the new Workspaces”, this time however using Server side script. A nice side effect of this approach is that we can avoid having to create the ACL.
Here are the steps to reproduce:
1. Create a Flow action (in my case a simple one that is creating a log entry)
2. Create code snipped for this Flow Action and copy the server side code:
3. Create a UI Action with the “Client” option unselected (In my case for the incident table):
4. Paste the code in the “Script” field
5. Select the both Workspace form button options so that this UI Action can also be used in Workspace. Here we leave the “Workspace Client Script” field empty, since it will run server side with the previously provided code in the field “Script”
6. Create a new Workspace (e.g. using App Engine)
7. In the Preview of a record (in my case incident) we see now the UI Action “Call Flow Action”
8. After clicking it, we can check the logs and see the corresponding log message created by the Flow Action:
I hope this helped. If yes, I would appreciate if you could mark this answer as "correct solution" or give a thumbs up. Thank you!
Greetings,
Sören

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2023 03:55 AM
Hello @KB1,
in order to make a Flow client callable you will have to create a specific ACL. I have done this multiple times in the past for exactly this use case (Calling a Flow/Subflow from a UI Action), and can therefore confirm that it is working.
Here is the official ServiceNow documentation with a step by step instruction on how to achieve this: https://docs.servicenow.com/bundle/utah-build-workflows/page/administer/flow-designer/task/grant-acc...
I hope this helped. If yes, I would appreciate if you could mark this answer as "correct solution" or give a thumbs up. Thank you!
Greetings,
Sören

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2023 06:25 AM
I don't think you'll be able to access the GlideFlow api directly from a UI Builder script. You'll either need to create a transform data resource that executes the flow or do a record update that triggers the flow.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2023 07:53 AM
Hello @KB1
I assume with the “Workspace Client Script” you mean the script field in a UI Action for Workspace as shown in the following Screenshot:
I double checked, and while calling the Flow action from the “UI16” client-side UI Action is working, it is not supported by the “Workspace Client Script” (shown in the screenshot). I have implemented this logic multiple times in the past, calling it from the “UI16” backend UI Actions.
However, I quickly created a working example that is calling a Flow Designer Action from a “Button on the new Workspaces”, this time however using Server side script. A nice side effect of this approach is that we can avoid having to create the ACL.
Here are the steps to reproduce:
1. Create a Flow action (in my case a simple one that is creating a log entry)
2. Create code snipped for this Flow Action and copy the server side code:
3. Create a UI Action with the “Client” option unselected (In my case for the incident table):
4. Paste the code in the “Script” field
5. Select the both Workspace form button options so that this UI Action can also be used in Workspace. Here we leave the “Workspace Client Script” field empty, since it will run server side with the previously provided code in the field “Script”
6. Create a new Workspace (e.g. using App Engine)
7. In the Preview of a record (in my case incident) we see now the UI Action “Call Flow Action”
8. After clicking it, we can check the logs and see the corresponding log message created by the Flow Action:
I hope this helped. If yes, I would appreciate if you could mark this answer as "correct solution" or give a thumbs up. Thank you!
Greetings,
Sören

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2023 11:43 PM
Hey @Soeren Maucher , this worked like a charm! Really appreciate your effort with the description and detailed steps! Thanks for this! Saved a lot of digging around without success.