Calling Shared Flow in Java Script Policy

Not applicable

Can we call shared flow from Java Script. I have a scenario where I am processing an array in java script, and for every record of that array, I want to call a shared flow to update some details of that record?

Solved Solved
1 3 526
1 ACCEPTED SOLUTION

Hi @vchikane1 - Not sure if you can. The option I can think off is, create another proxy that uses the Shared Flow and in your using JavaScript policy, call the proxy like any other http calls. There are many examples in the community and in our docs on how to use http calls within JavaScript policy

Let me know if you need anything else

View solution in original post

3 REPLIES 3

Hi @vchikane1 - Not sure if you can. The option I can think off is, create another proxy that uses the Shared Flow and in your using JavaScript policy, call the proxy like any other http calls. There are many examples in the community and in our docs on how to use http calls within JavaScript policy

Let me know if you need anything else

Yes! This is the right way.

An alternative would be to enhance the sharedflow so that it accepts an array as input. Rather than calling the shared flow (wrapped in a proxy) N times, each time with a payload containing one item, invoke the sharedflow once with a payload containing N items. Batch it.

This might not be possible with the way your logic in the sharedflow works.

Thanks a lot @Sai Saran Vaidyanathan and @Dino. I am going to modify my shared flow in such a way that it accetps an array, and will process that array in shared flow only.