MS CRM 4 Form Printing - "This form has been changed and must be saved before printing"

I have come across an issue with Printing a CRM 4 form today. The messege "This form has been changed and must be saved before printing" appeared when I tried to print a form even though the form data is already saved.
After digging into the problem I found that this perticular form had two custom controls (textbox and a command button), because of this CRM was assuming this form has unsaved (isdirty true) data.
There is a workaround to solve this issue by changing the printing javascript in the main form script file.
First you have to log in to the CRM applicaiton server and go to the following location;
In this location you can find a file named "". Open this file and find the print function which should look like this;

function Print()
if (isDirty())
var sId = _oSubmitForm.crmFormSubmitId.value;
openStdWin(prependOrgName("/_forms/print/print.aspx?objectType=" + _oSubmitForm.crmFormSubmitObjectType.value + "&id=" + sId + "&title=" + CrmEncodeDecode.CrmUrlEncode(parent.document.title)), "print" + buildWinName(sId));

You can edit the above function to skip the isdirty check for the perticular entity which has custom controls. This will bypass the above mentioned messege and will go directly to printing. Change would be to the if condition for isdirty checking which should be the following;

if (isDirty() && _oSubmitForm.crmFormSubmitObjectType.value != 112)

112 is the objecttypecode for Case, you can change this to your disered entities objecttypecode. Hope this will help you, please drop a comment if you have any issues.



Blog Directory -