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!
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);