Trigger callback function upon completion of business process execution


Hi all, 

Just wondering whether is there any way that we can run some javascript code / callback function upon completion of business process execution in client module?


If so, could you provide the sample code for reference?


Thank you very much.

Like 0





If this is needed for versions lower than 8.0.6 (version when the LiveEditing feature was added out-of-the-box that will reload entity automatically in case changes to it were applied by a process) - you can always send a socket message to the client-side logic (like in the example but the message sending mechanism should be in the last script-task of the business process, on the client-side create a method that is triggered upon receiving the message)  or use an already-developed marketplace addon for it.

To elaborate more on what Oleg mentioned. There's no way to have a callback for when the process completes (the callback commented in your code is a callback for the completion of *starting* the process). A process can have things that wait for a period of time, so not really possible to wait for completion.

The approach to take is for the process to notify the client-code that it has completed by sending it a message. This article shows how to send the message:…

If needed, this article shows how to receive the message in a Freedom UI page:…

However, if the page is Freedom UI, a better approach is to enable live data updates for the object so the refresh happens automatically when the data changes in the process. More about that here:…

From the code you posted, it looks like this is a classic page, so you'd have to go the first route for sending a message from the process to the client page.


Show all comments