I use an API call on my application page to return the tasks of a process, for example: Process 01 with the Tasks (Step1, Step2, Step3).
I need to create a javascript code that recognizes when a change from Step1 to Step 2 occurs. That is, when one task completes and moves on to the next. The problem is, the API always returns the outdated value from my task list. When a task is executed, the return of my API does not change automatically, I need something that does this.
Hello - when you say that the “return of my API does not change automatically”, are you talking about a “REST API extension” variable that you use in a page built using the UI Designer?
As I said above, I use an API to return information about tasks related to a process. One of the information that the API returns is the name of the task (displayName), but when the task is executed the information it should return is different.
I execute the Step2 task - API return is the same as the previous one.
I refresh the page - API return is updated.
My problem is that: I can not refresh the page, the information is not shown in a div, ie AJAX is not useful.
I need some method that only updates API return because I need the updated information to execute a javascript code.
Thank you for the clarification. The REST API Extension does not work like this, it basically makes the call at page load and that’s it. If you need to poll periodically I think the best is to create a dedicated custom widget with a bidirectional property.
You should have a look into this contributed Custom Wigdet . An HTTP call is being done to assign the current user to the current task (in a form). It should be a great example of what you need to do to make a valid REST API call to Bonita.
Bonitasoft empowers development teams with Bonita, the open-source and extensible platform to solve the most demanding process automation use cases. The Bonita platform accelerates delivery of complex applications with clear separation between capabilities for visual programming and for coding. Bonita integrates with existing solutions, orchestrates heterogeneous systems, and provides deep visibility into processes across the organization.