How to call Flow Action method from UI Builder?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 04:41 PM
Hi guys, we're really struggling with UI Builder advanced topics - does anyone know a way we can execute a Flow Action from UI Builder UI Event, like a Button action? We know we can create Flow Action and execute client or server script but how do you wire this up to UI builder? I hear that the GlideFlow is not supported so how can we call a script that does what we need. The Flow action would be a outbound rest message to save some data. Very common problem - very difficult to do without examples.
Extra credit - what are Client Script Includes in UI Builder and how do you create one that actually shows up in the dropdown?
thanks, please be specific we are new to this platform.
Marty

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 05:53 PM
Hi Marty,
In UI Builder, the primary way to communicate from the client-side to the server is through data resources. There is no ajax or script includes (client script includes are more a way to create reusable client-side code). There are a couple of ways you can interact with a flow. You could use an update or create record data resource to mutate a record and then key your flow off the record change, or you could use a transform data resource. A transform data resource allows you to kick off any server-side javascript upon execution of the data resource.
The second video in this blog post should give you some more details on how to create and use a transform data resource: https://developer.servicenow.com/blog.do?p=/post/quebec-ui-builder-data-resources/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2022 02:47 PM
Hi Brad, one issue with the transform developers are wondering - they are passing client state parameters to the transform but the transform is being called like three times, once on page load, once when when state changes and once when a user action needs to actually call the transform.
Can you help us figure out how to pass in a data parameter that is not sensitive to client state changes?
And secondly ideally would be a JSON request object! (I posted another Question about complex binding to client state parameters).
Devs need an an easy way to call flow from page with request object (from form fields).
thank you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2022 09:01 AM
I believe when you bind a CSP to a property on a data resource it will automatically refresh if teh CSP changes. I would change the CSP less often or utilize a secondary CSP. You might also try changing the data resource to only execute when called rather than immediately and see if that helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2022 09:47 AM
Hi Brad, actually one of our Now Architects mentioned we might be able to use the "Mutate Server Objects" checkbox and we found that we can now .Execute(args) rather than .Refresh(). But also looking for some guidance in terms of what your team might recommend. We cannot rely on CSPs - since they mutate too often.
Hopefully newer brokers coming that are more directly tied to using Action methods or flows.
If you want, we can post an example data broker script if anyone needs to know how to call REST API.
thanks Brad - keep up the great videos and education!
talk soon
Marty