
With Freedom UI pages, all client code executes as a request. There can be one, or multiple handlers of a request, but essentially, to do anything, you need a request to be executed for it to happen. This is the case saving the page as well. I’ve shown before how to handle (or respond to) the save request. In this article I will show how to initiate, or execute, the save request.
A handler on a Freedom UI page has a $context. This $context gives you access to things on the page such as attributes or other things. One of the things that is provided in the $context is a useful helper function to execute a request for the page (in 8.0.10 and above). This function simplifies the execution of a request (instead of using the HandlerChainService). Let’s say in this scenario we have a button on a page. If clicked, we want to first save the record, and then navigate to some other page. The code in our button’s click handler would look like this.
// create the save request const saveRecordRequest = { type: "crt.SaveRecordRequest", preventCardClose: true, $context: request.$context }; // now execute the save request and check if it was successful if ((await request.$context.executeRequest(saveRecordRequest))) { // save was successful, continue with something else here } else { // save was not successful (maybe due to required fields not being filled in) }
The code above will first execute a save request to save the page. If it was successful we could then do some other action as needed.
Subscribe To Our Newsletter
Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!
You have Successfully Subscribed!