Print Preview in Dynamics 365 New Unified Interface

Waleed Bin Afzal
4 min readOct 24, 2020

--

A couple of months back, we moved our organization from the legacy web interface to the new unified interface. The transition went smoothly however, there were few features missing from the new unified interface (still missing). Print Preview is one of them.

Here, I will show you step by step how I managed to get the print preview option work in the new Unified Interface.

Step: 1

Create a new solution in your D365 environment and add the entity in your new solution on which you want to have the print preview option. In my case, I am adding the bookable resource bookings entity.

Step: 2

You will need a small code of JavaScript to trigger the print preview which was present in the legacy web interface. Below is the code.

function printPreview(id) {

var url = Xrm.Page.context.getClientUrl() +

“/_forms/print/print.aspx?objectType=1145&id=”+id;

window.open(url);

}

This function basically gets the id of the record that you want to print and then pass that in the query string with the URL of the legacy print preview page.

Upload this JavaScript code file as a web resource in your solution that you created.

Step: 3

Now open the XrmToolBox and connect it to your instance. Go to tools and open the Ribbon Workbench (if you are unable to see the Ribbon Workbench in your tools, you may need to download it).

When you open the Ribbon Workbench, load the solution that you created in D365.

It will take some time to load the solution in XrmToolBox. Once it gets loaded in XrmToolBox, you will see the entity ribbons that you added to your solution.

Now go to commands and add a new command. Add a JavaScript Action. In the field of library, select the web resource you added in your new solution. Under function name, write the function name which you will be calling from the web resource. Now, since this function require a parameter (id) to be passed when called. Click on add parameter and add a CRM parameter. From the value field, select FirstPrimaryItemId.

Now from the toolbox, select the button control and drag that to the ribbon. Fill in the properties for the new button control and give it the name Print Preview. After filling, link this button with the command you created recently. Click publish once you are done with all the required settings.

Step: 4

Go to your D365 environment and open the entity where you have added the new button. In my case, it's the resource booking entity. Click on the print preview button and see the magic.

This feature will work until the old web interface is working. I am not sure will this work when Microsoft deprecates the legacy web interface completely which is scheduled by the end of this year. Well, till then at least this will solve the problem of many using the new unified interface or transitioning to the new unified interface.

--

--

Waleed Bin Afzal
Waleed Bin Afzal

Written by Waleed Bin Afzal

Microsoft Dynamics 365 CE Techno-Functional Consultant

Responses (2)