Creatio has an awesome low code/no-code business process framework that makes data updates very easy to build.

It also works well in conjunction with UI code. The UI code handles the high-level logic of delegation, while the business process framework can do the heavy lifting, leading to a much simpler codebase overall.

Business processes work in the background, which means that after all the data updates are done, it finishes its work and then notifies the UI so the UI can then decide to update itself with the necessary information.

Rather than have the screen wait on the process to execute, it is more efficient and user-friendly to have the screen still available to the user with the process efficiently working in the background in parallel. This makes the UI responsive to the user, while also allowing the business process to silently do the heavy lifting in the background without interrupting them.

To make this happen, we need the business process to let the UI know when it is done. How do we do this? Enter Creatio's messaging functionality.

It lets the business process send out a notification message that the application can listen for. So, whenever the business process finishes its work, a message (signal) is sent out. And of course, we also need to set up a "listener" on the other end, so it knows to look for this message and do something whenever it receives it.

To broadcast this message in a business process, we can use a simple script to post the message out via the script element at the very end of the business process. It looks something like this:

message image

The script will need a short bit of code to send out the message. In this case, there is a message indicating that data related to TimeLog information must be refreshed. Also, pay attention to make sure the message contains extra double quotes, as indicated below, so it does not have trouble when being packaged as JSON information.

script task image

Once the process runs, the "RefreshTimeLogDetail" message gets sent out after all processing is complete. This message now needs a listener set up to perform the receiving of the message.

To handle this, add a message listener on the page that should refresh/update whenever the "RefreshTimeLogDetail" message is sent. This can be done by adding the following code to the "methods" element on a page.


Note that "UsrSchemae9cdb495Detaildf7018cf" is the internal reference to the UI element that shows the TimeLog detail information. This should be changed as needed to name the appropriate detail element to be refreshed.

function image

Once this is all implemented, the detail area will automatically refresh when the business process runs in the background.

Note that the code uses the this.updateDetail method to refresh just one detail area of the screen. Ideally, we only want to refresh the appropriate areas and not perform a blanket refresh of the page, as this would slow performance. It is possible to also use the this.reloadEntity method, which will refresh all the main fields on the form, but care has to be taken because it could reload data while a user is in the middle of typing something on another area of the web page.

To summarize, rather than building a lot of code into the page to perform data updates and refreshes, we can offload much of the code logic into a low code business process and have the Creatio UI just talk to the business process using some cool messaging tricks, making everything work together nicely.

Posted in:

Looking for Creatio help?

We do training, customization, integration, and much more. Contact us today.