Dynamics 365 Open Lookup in New Window

John Towgood, 03 August 2018

The default behaviour when a user clicks on a lookup field in Dynamics 365, is that it opens the record in the same window. In some scenarios this behaviour is not ideal since users may want to open related lookup records in another window to view more information to assist in populating fields in the current record or make decisions.

Quick view forms can display fields from the related record, but this would involve customization to the quick view form every time a new field needs to be displayed.

An alternative to this, is by using a Web Resource that opens the related lookup record in a new form behaving like CRM 2011. This simple Web Resource is ideal for scenario’s where the lookup field is re-populated, since the web resource is in a read-only state and only changes if the source lookup control changes value.


The following steps demonstrates how to create a HTML Web Resource to achieve this new window popup behavior. Note that this uses unsupported JavaScript:

  1. Obtain the name of the source lookup field which is passed in as a Web Resource custom parameter, e.g. “accountid”.
  2. Setup an on change event against the source lookup field so when a user changes the lookup value the link is re-generated to reference the new lookup record.

  3. Get the value of the lookup field and generate html tags to display the records name and assign an onclick event which executes the openNewForm() function passing the id of the record and logical name.

  4. Execute the new version 9 Client API function Xrm.Navigation.openForm() to open the record in a new window.

  5. Apply CSS styling to the HTML web resource to achieve the same look and feeling as a standard Dynamics 365 lookup controls with an icon to indicate to a user that this is a custom Web Resource control.

  6. Add the new Web Resource control to a form and configure to have a label and custom parameter set as the lookups field name.
  7. Format layout as 1 column and 1 row with scrolling set a never and display border unchecked.


Repeat steps 6. and 7. if you want to apply the window popup behavior against another lookup field. The only changes you would make is the label and custom parameter which would be set to the lookups field name.

So, to conclude this simple Web Resource is a good solution to resolve scenario where users would need to view another related record for more information to assist in populating data or decision making.