Open Dialog using URL in Dynamics 365

Dialogs are the interactive processes which takes input from user and process the data and gives output. For many scenarios users run dialogs to achieve required task. Dynamics 365 provides a out-of-the-box command button option called as “Run Dialog” which gives a list of activated dialogs created against the specific entity.

There is also a common cusomization to directly open a dialog by clicking a command button for spefic records or selected records for an entity. For this scenario we have to identify the dialogid (the GUID of the dialog to be opened), entity logic name (entity logical name of the entity on which the dialog is created) and objectid (the record id on which the dialog will run to process data).

The URL format to open a dialog is given below.

[organization url]/cs/dialog/rundialog.aspx?DialogId=[dialog unique identifier]&EntityName=[entity logical name]&ObjectId=[unique identifier for the record]

The query strings for the URL is explained below.

DialogId The unique identifier for the dialog.
EntityName The logical name for the entity the dialog is created for.
ObjectId The unique identifier for the record you want to have the dialog run against.

 

How to get the DialogId?

To get the unique identifier for the dialog, navigate to Settings, in the default solution select Processes. Select a process and then in the Actions options on the command bar, click Copy a Link. This will copy a link to edit the dialog to your clipboard, for example, [organization url]/sfa/workflow/edit.aspx?id=%7b6A6E93C9-1FE6-4C07-91A9-E0E2A7C70976%7d.

A Sample Dialog screen

Sample Code:

Function Definition

function openDialogProcess(dialogId, entityName, objectId){ var url = Xrm.Page.context.getClientUrl() +  "/cs/dialog/rundialog.aspx?DialogId=" +  dialogId + "&EntityName=" +  entityName + "&ObjectId=" +  objectId; window.open(url);}

Calling the Funcion:

function OpenDialogButton_OnClick()

{

openDialogProcess(”7b6A6E93C9-1FE6-4C07-91A9-E0E2A7C70976”,”account”,”7b6A6E93C9-1FE6-4C07-91A9-E0E2A7C70976” );

}