Skip to content

ClosePage

You have the option to either close the pages once the ongoing events are complete or terminate them and subsequently close the pages. You can also go back to a specific page in the backstack of the current frame instead of clicking the back button multiple times.

The properties defined in Action are also applicable to this action.

ClosePage Properties

Property Type Required Default
CancelPendingActions boolean Optional false
DismissModal enum Optional
NavigateBackToPage string Optional
_Type const Required

CancelPendingActions

Controls whether to cancel any other pending actions when the action runs.

  • type: boolean
  • default: false

DismissModal

Control how the page is closed.

  • type: enum

The value of this property must be equal to one of the known values below.

Value Description
Action.Type.ClosePage.Completed Closes the page after pending actions, i.e. actions that haven't been executed, are executed.
Action.Type.ClosePage.Canceled Terminates execution of current and pending actions, and closes the page.

This property allows you to navigate back to a specific page in the navigation history stack. It accepts the _Name property of the page you want to navigate back to. If the specified page is not found in the navigation history stack then this action will fail, and the current page will not be closed. If the specified page is found in the navigation history stack then the current page will be closed, and you will be navigated to the specified page. The pages between the current page and the specified page in the navigation history stack will be disposed and their OnReturning event will not be triggered.

Notes: This property will be ignored if DismissModal or CancelPendingActions properties are defined. You can only navigate back to a page within the same frame. For example, if you are closing a page inside a modal frame, then you can only specify a page name that's within the same modal's navigation history stack. You can't specify a page that is in the main navigation history stack behind the modal.

  • type: string

_Type

  • type: const

The value of this property must be equal to:

"Action.Type.ClosePage"

Action Result

Refer to the MDK Guide to understand what an action result is.

The success ActionResult of this action is null. The failure ActionResult is an error message.


Examples

Close page

Normal close

{
  "_Type": "Action.Type.ClosePage"
}

Close page with pending actions cancelled

A typical use case is to have a change set action executing. When any of the modal pages are closed with the change set action cancels all pending actions and closes the modal page.

{
  "_Type": "Action.Type.ClosePage",
  "DismissModal": "Action.Type.ClosePage.Cancel"
}

Close page after compeleting pending actions

A typical use case is to have a change set action executing. When the last modal page is closed with the change set action commits and the modal page is closed.

{
  "_Type": "Action.Type.ClosePage",
  "DismissModal": "Action.Type.ClosePage.Completed"
}

Multiple go back

A typical use case is when you are in a product list page with _Name property as "ProductList" and go through several pages to create an entity. After the entity is created, you want to go back to the product list page directly.

{
  "_Type": "Action.Type.ClosePage",
  "NavigateBackToPage": "ProductList"
}