Open Forms, Views, Dialogs and Reports with a URL

[Applies to: Microsoft Dynamics CRM 2011]

URL addressable elements enable you to include links to Microsoft Dynamics CRM forms, views, dialogs, and reports in other applications. In this manner, you can easily extend other applications, reports, or websites so that users can view information and perform actions without switching applications.

  • URL addressable forms, views, dialogs, and reports cannot bypass Microsoft Dynamics CRM security. Only licensed Microsoft Dynamics CRM users, based on their security roles, can access the data and the records they see.

  • Use Xrm.Utililty.openEntityForm when opening entity forms programmatically. This function was added in Microsoft Dynamics CRM 2011 Update Rollup 8.

  • Microsoft Dynamics CRM forms are not designed to be opened as dialogs using either showModalDialog or showModelessDialog.

In This Topic

Save & Close or Finish Buttons May Not Work When a Window is Opened From a Link

For browsers other than Internet Explorer, if an entity form or dialog process is opened from a link the Save & Close or Finish buttons may not work. The record will be saved but the user will need to click the close button on the window to close it. This is because other browsers do not provide a window.close method if the window is not opened using JavaScript from another window. When possible, use JavaScript and the Xrm.Utility.openEntityForm function or the method to open entity forms and dialog processes rather than simply providing links.

URL Addressable Forms and Views

All entity forms and views are displayed in the main.aspx page. Query string parameters passed to this page control what will be displayed. For example:

To open a new account entity record form for on-premises Microsoft Dynamics CRM:
To open an account entity record form for Microsoft Dynamics CRM Online where the id is {91330924-802A-4B0D-A900-34FD9D790829}:
To open the Closed Opportunities view for Microsoft Dynamics CRM Online:

With Microsoft Dynamics CRM 2011 Update Rollup 12 and Microsoft Dynamics CRM December 2012 Service Update you will typically use the Xrm.Page.context.getClientUrl method to retrieve the organization root Url for both on-premises Microsoft Dynamics CRM and Microsoft Dynamics CRM Online.

If your organization has been updated to Microsoft Dynamics CRM Online Fall ’13, please use the latest version of the SDK. Download the updated SDK package for Microsoft Dynamics CRM 2013 and CRM Online Fall ‘13.

Trim Trailing Forward Slash Character with Microsoft Dynamics CRM Online when using Xrm.Page.context.getServerUrl

With Update Rollup 12 and the December 2012 Service Update, use Xrm.Page.context.getClientUrl to retrieve the organization root URL. Xrm.Page.context.getServerUrl function is deprecated in Update Rollup 12 and the December 2012 Service Update.

When you use the Xrm.Page.context.getServerUrl method to retrieve the organization root URL the string returned by Microsoft Dynamics CRM Online includes a trailing forward slash character. If this trailing forward slash is not removed, the ribbon will not display. You should remove this character so that you can consistently append the rest of the URL to the organization root URL. The following code can be used:

if (serverUrl.match(/\/$/))
serverUrl = serverUrl.substring(0, serverUrl.length - 1);

Query String Parameters for the Main.aspx Page

To get the id value for any record, use the Copy a Link button in the Collaborate group in the ribbon. The following is an example of what will be copied to your clipboard:


The id parameter passed to the URL is the encoded id value for the record. In this example the id value is {899D4FCF-F4D3-E011-9D26-00155DBA3819}. The encoded version of the GUID substitutes opening and closing brackets “{” and “}” with “%7B” and “%7D”, respectively,

The following are the query string parameters for the main.aspx page:


Parameter Description


The logical name of the entity.

Do not use the etc (entity type code) parameter that contains an integer code for the entity. This integer code varies for custom entities in different organizations.


Optional for forms. This parameter contains encoded parameters within this parameter.

Use this parameter to pass values to a form. For more information, see Set Field Values Using Parameters Passed to a Form.

When an entity has more than one form defined, you can use this parameter to specify which form to open by passing the encoded parameter formid with the value equal to the ID value of the form. For example, to open a form with the ID of ‘6009c1fe-ae99-4a41-a59f-a6f1cf8b9daf’, include this value in the extraqs parameter: formid%3D6009c1fe-ae99-4a41-a59f-a6f1cf8b9daf%0D%0A.


The type of page. There are two possible values:

  • entityrecord

    Displays an entity record form.

  • entitylist

    Displays an entity view.


Optional for forms. Use this when you open a specific entity record. Pass in the encoded GUID identifier for the entity. The encoded version of the GUID substitutes opening and closing brackets “{“ and “}” with “%7B” and “%7D”, respectively, for example {91330924-802A-4B0D-A900-34FD9D790829} is %7B91330924-802A-4B0D-A900-34FD9D790829%7D.


Required for views. This is the ID of the savedquery or userquery entity record that defines the view. The easiest way to get the URL for a view is to copy it. For more information, see Copy the URL for a View.


Defines the view type. Possible values are as follows:

  • 1039

    Use for a system view. The viewid represents the Id of a savedquery record.

  • 4230

    Use for a personal view. The viewid represents the Id of a userquery record.

Copy the URL for a View

Many views in Microsoft Dynamics CRM let a user copy the URL for a particular view or send an email with the URL for a particular view embedded in the message. This feature makes communication between users easier, and exposes a way for you to gain access to a URL for a view that users can include in another application, such as a SharePoint site.

Do not use this URL to include the view in application navigation using the site map. For more information, see Display a View in the Application Navigation using the Site Map.

The page displayed by the URL includes the full view. This includes the ribbon, but does not include the application navigation.

Get the URL for a View

  1. Open the view you want to use.

  2. In the ribbon Collaborate group, click Copy a link, and then click Of Current View.

  3. Paste the link into Notepad and edit it to extract only the URL part of the text that you want.

  • Views that use the user context as a parameter, such as My Accounts, cannot be copied.

  • The GUID that represents system views for system entities will be the same for each on-premises Microsoft Dynamics CRM installation. The GUID for custom entities and custom views will be unique for each Microsoft Dynamics CRM installation.

Display a View in the Application Navigation using the Site Map

When you customize the application navigation using the site map, do not use the view URL that you copied from the application using the steps in Copy the URL for a View to set as the URL. That URL displays a page that includes the ribbon and produces undesirable results if used in a <SubArea> (SiteMap) Url attribute.

To display a list of entity records within the application for a SubArea set the Entity attribute value. This displays the default view for that entity and provides the correct title and icon.

However, if you want to have a SubArea element that uses a specific initial default view, use the following Url pattern.

Url=“/_root/homepage.aspx?etn=<entity logical name >&amp;viewid=%7b<GUID value of view id>%7d”

When you use this URL, you must also specify appropriate values for <Titles> (SiteMap) and <Descriptions> (SiteMap), and specify an icon for the entity.

If you specify the view using the /_root/homepage.aspx page, the view selector will still be shown. If the user changes the view, Microsoft Dynamics CRM remembers the user’s most recent selection and the initial default view displays after they close and re-open their browser.

Opening a Dialog Process by Using a URL

A common customization is to enable a user to open a specific dialog process in the context of a specific record. For example, you might want to add a custom button to the ribbon for a specific entity using the id value for current record as an input parameter for the dialog process.

To open a dialog you need the following:

  • The unique identifier for the dialog.

  • The logical name for the entity the dialog is created for.

  • The unique identifier for the record you want to have the dialog run against.

To get the unique identifier for the dialog, navigate to Settings, and in the Process Center group, select Processes. Right click the dialog, and in the context menu, select 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.

The following sample shows the URL and query string parameters to open a dialog:

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

For example, to open the dialog with id ={6A6E93C9-1FE6-4C07-91A9-E0E2A7C70976} with the account record id = {40C9ADFD-90A8-DF11-840E-00155DBA380F}, use the URL in the following example.

          [organization url]/cs/dialog/rundialog.aspx?DialogId=%7b6A6E93C9-1FE6-4C07-91A9-E0E2A7C70976%7d&EntityName=account&ObjectId=%7b40C9ADFD-90A8-DF11-840E-00155DBA380F%7d

With Update Rollup 12 and the December 2012 Service Update, you can create a JavaScript function to open the dialog as shown in the following example:

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

Opening a Report by Using a URL

You can open a report by passing appropriate parameter values to the following URL: [organization url]/crmreports/viewer/viewer.aspx.

This URL accepts the following parameters:

Two possible values for this parameter are run or filter. When run is used, the report will be displayed using the default filters. When filter is used, the report will display a filter that the user can edit before clicking the Run Report button to view the report.

This parameter is optional. For reports that are included with Microsoft Dynamics CRM 2011 the value in this parameter allows the Help button to display appropriate content about this report when Help on This Page is chosen. The value should correspond to the report FileName attribute value.

This parameter is the report ReportId attribute value.

The following examples show URLs that can be used to open reports in Microsoft Dynamics CRM.

Open the Neglected Cases report using the default filter:
[organization url]/crmreports/viewer/viewer.aspx?action=run&helpID=Neglected%20Cases.rdl&id=%7b8c9f3e6f-7839-e211-831e-00155db7d98f%7d
Open the Top Knowledge Base Articles report and prompt the user to set filter values:
[organization url]/crmreports/viewer/viewer.aspx?action=filter&helpID=Top%20Knowledge%20Base%20Articles.rdl&id=%7bd84ec390-7839-e211-831e-00155db7d98f%7d

The following function shows how to properly encode values in the URL:

  function getReportURL(action,fileName,id) {
   var orgUrl = GetGlobalContext().getClientUrl();
   var reportUrl = orgUrl + 
    "/crmreports/viewer/viewer.aspx?action=" +
    encodeURIComponent(action) +
    "&helpID=" +
    encodeURIComponent(fileName) +
    "&id=%7b" +
    encodeURIComponent(id) +
   return reportUrl;

See Also

Microsoft Dynamics CRM 2011
Send comments about this topic to Microsoft.
© 2013 Microsoft Corporation. All rights reserved.

Community Additions