first we have to find the print() function. open WWWROOT folder and go to INETPUB in your machine.
Then open this folder
Open form.crm.htc file
find the Print() function.
function Print()
{
if (isDirty())
{
alert(LOCID_FORM_PRINT_DIRTY_MESSAGE);
}
else
{
var sId = _oSubmitForm.crmFormSubmitId.value;
openStdWin("/_forms/print/print.aspx?objectType=" + _oSubmitForm.crmFormSubmitObjectType.value + "&id=" + sId + "&title=" + encodeURIComponent(parent.document.title), "print" + buildWinName(sId));
}
}
Here you can see that system check dirty values on the form. so edit the code according to your needs and skip validating dirty values. Then you can print your CRM form.
Following example shows how to skip this dirty check for a specific entity using the object type code.
function Print()
{
if(parentForm.ObjectTypeCode == 10034)
{
var sId = _oSubmitForm.crmFormSubmitId.value;
openStdWin("/_forms/print/print.aspx?objectType=" + _oSubmitForm.crmFormSubmitObjectType.value + "&id=" + sId + "&title=" + encodeURIComponent(parent.document.title), "print" + buildWinName(sId));
}
else
{
if (isDirty())
{
alert(LOCID_FORM_PRINT_DIRTY_MESSAGE);
}
else
{
var sId = _oSubmitForm.crmFormSubmitId.value;
openStdWin("/_forms/print/print.aspx?objectType=" + _oSubmitForm.crmFormSubmitObjectType.value + "&id=" + sId + "&title=" + encodeURIComponent(parent.document.title), "print" + buildWinName(sId));
}
}
}