{Scripting} Opening Print preview through JavaScript for Dynamics CRM 2013/2015

Recently I was going through some CRM forums and found out that there is a way to open print preview via JavaScript as well.

Add following function and call it from wherever you want on form:

1. function PrintPreview() {

2.

3. window.open(Xrm.Page.context.getClientUrl() + “/_forms/print/print.aspx?allsubgridspages=false&formid=” +

4. Xrm.Page.ui.formSelector.getCurrentItem().getId() + “&id=” + Xrm.Page.data.entity.getId() +

5. “&objectType=” + Xrm.Page.context.getQueryStringParameters().etc);

6. }

Ask your Query : Click here

Hope it helps!

Advertisement

One thought on “{Scripting} Opening Print preview through JavaScript for Dynamics CRM 2013/2015

  1. Hi Deepesh,

    I tried running this JavaScript on click on an ISV button. But getting error

    function GetUserGuid(){
    debugger;

    window.open(Xrm.Page.context.getClientUrl() +
    “/_forms/print/print.aspx?allsubgridspages=false&formid=”//Getting error here near “/_forms.(invalid character). I tried to remove / and _ but still I get error.
    + Xrm.Page.ui.formSelector.getCurrentItem().getId() + “&id=”
    + Xrm.Page.data.entity.getId() + “&objectType=”
    + Xrm.Page.context.getQueryStringParameters().etc);

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