Adding Code to the Save Event of a Creatio Freedom UI Page

In classic pages in Creatio, if you wanted to add code to the page’s save event, you simply had to add a save function to override the base page save function, do your work, then use this.callParent(arguments) to call the base page save function (so it actually saves the page). In Freedom UI pages, if you want to do this, you’ll need to add a handler for the page’s save request, which is called crt.SaveRecordRequest. This article will take a look at how this is done.

In the page where you want to do something in the save event, locate the handlers section, then add the following code:

{
	request: "crt.SaveRecordRequest",
	handler: async (request, next) => {
		// Add any code to execute *before* the save here
		// This is useful to set values before the save so it saves with the record
		
		// Wait for the base page to execute it's handler to save the page
		const saveResult = await next.handle(request);
					
		// Add any code here to execute *after* the save has happened here

		// now return the saveResult
		return saveResult;
	}
}

It’s most typical that you’re wanting to do things *before* the save happens (so you can save values with the record). In that case, the above can be simplified to the following:

{
	request: "crt.SaveRecordRequest",
	handler: async (request, next) => {
		// Add any code to execute *before* the save here
		
		return next.handle(request);
	}
}
ABOUT THE AUTHOR

Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. His new passion for CRM is Creatio, formerly bpm'online. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

Submit a Comment

Your email address will not be published. Required fields are marked *

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!