I often use backend validation in Creatio - I prevent saving a record and throw an exception from an event listener. It works like a charm, but as a result, the end user sees only a toast message, which is small and disappears after a moment, so it's easy to overlook. Is it possible to intercept such an error and display a normal confirmation popup, instead of thisone?
It would be great if there is a generic solution, which doesn't require me to change all of my validations.
As an alternative you can use websockets to implement your logic.
Here i created a custom section and a clientMessageBridge as described in this article. In this section i created a Test Field. To subscribe to message broadcasting in the HandleViewModelInitRequest handler i used schema attribute to store a function that will be called whenever a message is published. Also note, that you should unsubscribe from websocket connection when your view is destroyed. To do this please don't forget to implement such logic in HandleViewModelDestroyRequest handler.
On the form page when user clicks Save button a custom MyCustomRequest handler is called. In this handler i realized the following logic: call a business process (where i pass Test Field value as well as expected business process parameter value) -> if there is no validation error that is passed back from business process (hasValidationErrors property) i call SaveRecordRequest request -> if there is an error - the SaveRecordRequest is not performed.
Also the function that is triggered when a websocket message is broadcasted does open a pop-up which displays error message.
Here is an example:
And the outcome:
Hope this helps and let me know if you have any question left.
Please help, I need to notify final user some task he trigger is working.
For example, on a page, a user clicks on a button to do something, the button executes a process and I want to inform the client that it is processing what the process does....
I've typically done this by making a generic process I can use as a subprocess. It sends the message to the client. Then I make a generic script loaded from MainShell or MainHeaderSchema that listens for the message and displays the toast. It makes it simple and generic to use and works on any page.
I've typically done this by making a generic process I can use as a subprocess. It sends the message to the client. Then I make a generic script loaded from MainShell or MainHeaderSchema that listens for the message and displays the toast. It makes it simple and generic to use and works on any page.
How do you go about creating a generic script that loads in the MainShell or MainHeaderSchema in Freedom UI? It hasn't seemed to work when I've tried it.