back to top

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.

Contact Customer FX for your CRM project
We let our expertise speak for itself - let us know how our all-star team can help on your CRM project
About the Author
Ryan Farley
Ryan Farleyhttps://customerfx.com/article/author/ryanfarley/
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.

6 COMMENTS

  1. Hi Ryan,

    If your page is in CardState = “add”, and you’re reloading the page after preventCardClose, then the url remains with /add format rather than /edit/guid, wich seems to be a Creatio issue IMO.

  2. You can also specify this param directly on the button click action, in case you want some save buttons to behave this way but not all save actions:

    "clicked": {
    	"request": "crt.SaveRecordRequest",
    	"params": {
    		"preventCardClose": true
    	}
    }
  3. Hi Ryan,
    thank you for the article, it was helpful.

    I have a question regarding a slightly different scenario.
    In my case, the Case page is opened in edit mode from a business process (Open Edit Page). After saving the record, the page is automatically closed, but I need to stay on the same page after save.

    I tried using preventCardClose as described in the article, but it seems that this approach does not work when the page is opened from a business process.

    I added the following handler:

    {
        request: "crt.SaveRecordRequest",
        handler: async (request, next) => {
            request.preventCardClose = true;
    
            const result = await next?.handle(request);
            if (!result || result.error) {
                return result;
            }
    
            return result;
        }
    }

    However, the page is still closing after save.

    Is there a recommended approach or alternative solution for this scenario when the page is opened via a business process?

    • I’ve not checked, but it could be that the logic has changed slightly in recent versions. In current versions of Creatio, the save button (any button with a Save data action) has a property to indicate whether to close the page or not. You can just set it there (it’s possible it has to be set prior to the request firing now?)

  4. I tried an alternative workaround on my side.

    I added a boolean flag on the Case record to indicate that the page was opened via a business process. Then, in the SaveRecordRequest handler, I check this flag and explicitly trigger an UpdateRecordRequest for the same record.

    const isCreatedInProcess = await request.$context.PDS_QicIsCreatedInProcess;

    if (isCreatedInProcess) {
    const recordId = await request.$context.Id;
    const handlerChain = sdk.HandlerChainService.instance;

    await handlerChain.process({
    type: “crt.UpdateRecordRequest”,
    entityName: “Case”,
    $context: request.$context,
    recordId: recordId
    });
    }

    As a result, after saving, the record remains opened in edit mode, which is the expected behavior.
    During testing this works correctly in most cases.

    However, occasionally an error appears in the browser console, and in those cases the Save button is no longer visible when the page is opened in edit mode via the business process.

    message: Uncaught TypeError: Cannot read properties of undefined (reading ‘name’)
    stack: TypeError: Cannot read properties of undefined (reading ‘name’)

    So while this workaround mostly works, it does not seem to be fully stable.
    I wanted to check if this approach is valid in general, or if there is a more correct way to handle this scenario for pages opened from processes.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

AI Readiness Checklist for CRM Teams: Is Your CRM System Ready for AI?

Before using AI in Creatio, make sure your CRM data, users, processes, and automation foundation are ready. Use this practical AI readiness checklist for CRM teams.

Build Your Creatio AI Skills with the 2026 AI Summer Program

Join Creatio’s free 2026 AI Summer Program to learn how to identify, build, deploy, and manage AI agents.

Creatio 10x Is Coming: Join the Webinar to Explore the Future of AI-Native CRM

Learn what's new in Creatio 10x and how AI-native CRM, agentic AI, and no-code automation are shaping the future of customer relationship management. Join the upcoming webinar and discover what's next.

Creatio Unlimited Pricing Explained: AI Packages, Costs, Pros & Cons

Learn what Creatio’s new Unlimited pricing model includes, what it doesn’t include, how AI Action packages work, and the pros and cons for businesses evaluating Creatio.

Using the AI Prompt to Create Dynamic Folders in Creatio

Using Creatio's AI prompt to create the filter for a dynamic folder works best if you specifically ask for that, and if you are as clear and direct as possible about the filtering, conditions.

Related Articles

AI Readiness Checklist for CRM Teams: Is Your CRM System Ready for AI?

Before using AI in Creatio, make sure your CRM data, users, processes, and automation foundation are ready. Use this practical AI readiness checklist for CRM teams.

Build Your Creatio AI Skills with the 2026 AI Summer Program

Join Creatio’s free 2026 AI Summer Program to learn how to identify, build, deploy, and manage AI agents.

Creatio 10x Is Coming: Join the Webinar to Explore the Future of AI-Native CRM

Learn what's new in Creatio 10x and how AI-native CRM, agentic AI, and no-code automation are shaping the future of customer relationship management. Join the upcoming webinar and discover what's next.

Creatio Unlimited Pricing Explained: AI Packages, Costs, Pros & Cons

Learn what Creatio’s new Unlimited pricing model includes, what it doesn’t include, how AI Action packages work, and the pros and cons for businesses evaluating Creatio.

Related Videos