Taking Your Model-driven App to the Next Level with Xrm.App.sidePanes

Side panes are a type of interface component that can display related information or actions to the user in a panel on the side of the screen. This can be particularly useful for improving the user experience by reducing the need to switch between different pages or tabs.

Here’s an example of how to use the Xrm.App.sidePanes API to create a custom side pane:

function openCustomSidePane() {
  var context = Xrm.Utility.getGlobalContext();
  var entityFormOptions = {};
  entityFormOptions["entityName"] = "account";
  entityFormOptions["entityId"] = Xrm.Page.data.entity.getId();
  entityFormOptions["openInNewWindow"] = true;
  entityFormOptions["height"] = 600;
  entityFormOptions["width"] = 400;
  var navigationOptions = {};
  navigationOptions["target"] = 2; // 2 = Side Pane
  Xrm.Navigation.navigateTo(entityFormOptions, navigationOptions);
}

In this example, the openCustomSidePane function creates a side pane that displays a new instance of the account form when the user clicks a button. The Xrm.Utility.getGlobalContext() method is used to retrieve the current context, and the Xrm.Page.data.entity.getId() method is used to retrieve the ID of the current record.

The entityFormOptions object is used to define the properties of the new account form that will be displayed in the side pane. In this case, the entityName property is set to “account” to indicate that a new instance of the account form should be opened, and the entityId property is set to the ID of the current record. The openInNewWindow property is set to true to indicate that the form should be opened in a new window, and the height and width properties are set to specify the size of the side pane.

Finally, the navigationOptions object is used to specify the options for the navigation, including the target property, which is set to 2 to indicate that the new form should be opened in a side pane.

To call the openCustomSidePane function from a button on the account form, you can add a custom function to the button’s OnSelect event. When the user clicks the button, the openCustomSidePane function will be called and a new side pane will be displayed containing the new instance of the account form.

Additionally, side panes may not be supported in all versions of Dynamics 365 or may have limitations based on the user’s security role. It’s important to thoroughly test any customizations before deploying them to a production environment.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s