Call a Flow Action from service portal

maryc
Tera Contributor

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

 

1 ACCEPTED SOLUTION

Its_Azar
Tera Guru

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.

☑️ If this helped, please mark it as Helpful or Accept Solution so others can find the answer too.




Kind Regards,

Mohamed Azarudeen Z

Developer @ KPMG

 Microsoft MVP (AI Services), India

View solution in original post

3 REPLIES 3

Sonam_Tiwari
Kilo Sage

Go to the flow you want to call and navigate as per the screenshot:

 

Sonam_Tiwari_0-1713907161890.png



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,

 

 

Consider indicating the response as helpful and marking it as correct if it meets your needs.

Neel Patel3
Giga Guru

Hi Mary,

 

Yes you can!

You can create and call a script include (which triggers the flow) in server side of your widget.

Its_Azar
Tera Guru

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.

☑️ If this helped, please mark it as Helpful or Accept Solution so others can find the answer too.




Kind Regards,

Mohamed Azarudeen Z

Developer @ KPMG

 Microsoft MVP (AI Services), India