- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 01:10 PM
Hello,
How do I call a Flow action from Service Script in a Service Portal Widget?
The action returns a URL and I want the page to be redirected to the new URL
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 03:29 PM
Hi there @maryc
Firstly, within your Service Script, invoke the Flow action using either Glide Flow API calls or REST API calls if the Flow action is exposed as a REST API. Capture the URL returned by the Flow action.
Once you have the URL, use JavaScript to redirect the page accordingly. This can be achieved by setting window.location.href to the URL obtained from the Flow action.
var flowActionUrl;
if (flowActionUrl) {
window.location.href = flowActionUrl;
} else {
console.error('Flow action did not return a URL.');
}
If this helps kindly accept the answer thanks much.
Kind Regards,
Mohamed Azarudeen Z
Developer @ KPMG
Microsoft MVP (AI Services), India
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 02:30 PM
Go to the flow you want to call and navigate as per the screenshot:
Copy the code snippet and use in your server side script. Once you fetch the output url
use window.open(url,'_blank') to redirect to a url
Place the scripts in the widget based on your use case,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 02:32 PM
Hi Mary,
Yes you can!
You can create and call a script include (which triggers the flow) in server side of your widget.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 03:29 PM
Hi there @maryc
Firstly, within your Service Script, invoke the Flow action using either Glide Flow API calls or REST API calls if the Flow action is exposed as a REST API. Capture the URL returned by the Flow action.
Once you have the URL, use JavaScript to redirect the page accordingly. This can be achieved by setting window.location.href to the URL obtained from the Flow action.
var flowActionUrl;
if (flowActionUrl) {
window.location.href = flowActionUrl;
} else {
console.error('Flow action did not return a URL.');
}
If this helps kindly accept the answer thanks much.
Kind Regards,
Mohamed Azarudeen Z
Developer @ KPMG
Microsoft MVP (AI Services), India