Prevent Closing or Navigating Back From a Freedom UI Page when Saved in Creatio

In a previous article I showed how to prevent navigating back, or closing a Classic UI page when it is saved in Creatio. The previous method would pass a config object to the save method with an isSilent property (if isSilent is true it would prevent the form from closing). For a Freedom UI page, that previous method does not work, however, there is an easy equivalent. You must handle the save on the page by adding a crt.SaveRecordRequest and then can set a preventCardClose property on the request to prevent the form from closing.

{
    request: "crt.SaveRecordRequest",
    handler: async (request, next) => {
        request.preventCardClose = true;
        return next.handle(request);
    }
}

Note, this does work as expected, but does produce some odd results on some pages. For example, the Case page shows several things once the CreatedOn is populated and it appears that the data isn’t reloaded after the save. The code above will prevent the page from closing, but without the data being reloaded (and since many elements on the page are shown using the population of the CreatedOn) you might, in some cases, also have to do a reload in addition to this.

Want content like this delivered to your inbox? Sign up for our newsletter!
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 *