
In Creatio classic pages, you could add a function called onEntityInitialized to perform things when an edit page loads and the data is available to access. In Freedom UI pages, to do the same, you need to wire up a handler for the crt.HandleViewModelInitRequest.
To add code to the page that will fire when the page’s model/data is available and ready, simply add the following to the page’s handlers:
{ request: "crt.HandleViewModelInitRequest", handler: async (request, next) => { // allow base page initialization to complete await next?.handle(request); // add any custom code here } }
This is the equivalent to the onEntityInitialized in a Freedom UI page. In this handler, you can also to things you’re used to doing in classic Creatio pages as well. For example, check if the page is for and “add” or “copy”:
{ request: "crt.HandleViewModelInitRequest", handler: async (request, next) => { await next?.handle(request); const cardState = await request.$context.CardState; if (cardState == "add" || cardState == "copy") { // do something here } } }
Additionally, any field/attribute values from the page can be accessed via the request.$context.
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!