var SendToPrintCenterOnClick = function ()
{
try
{
if(TEST.Helper.DisplayConfirm("Are you sure you want to send to print center?"))
{
var MandatoryFieldBlankCounter = 0;
var attributes = TEST.Helper.GetAttributes();
for (var i in attributes)
{
if (attributes[i].getRequiredLevel() == "required" && attributes[i].getName() != "statecode" && attributes[i].getName() != "statuscode")
{
if (TEST.Helper.GetXrmControlValue(attributes[i].getName()) == null || TEST.Helper.GetXrmControlValue(attributes[i].getName()) == undefined)
{
MandatoryFieldBlankCounter++;
break;
}
}
}
if (MandatoryFieldBlankCounter == 0)
{
window.PluginTrigger = true;
TEST.Helper.SetXrmControlValue(TEST.Constants.Entity.CALL_ISSUE_FORM.PluginTrigger, (new Date().getTime() + Math.random()) + "");
Xrm.Page.data.save().then(
function ()
{
TEST.Helper.NeverSubmitAllAttributes();
_LoadCallIssueForm();
},
function (errorCode, message)
{
if (errorCode != undefined && errorCode != null)
{
TEST.Helper.DisplayMessage(message + " Error Code " + errorCode);
}
else
{
TEST.Helper.DisplayMessage("An error occurred which prevents the save of the Call Issue Form.Please try the action again or contact CRM Support.");
}
}
);
return true;
}
else
{
TEST.Helper.DisplayMessage("Please ensure all mandatory fields have data before you send to print center.");
return false;
}
}
else
{
return false;
}
}
catch(err)
{
TEST.Helper.DisplayAndWriteMessage("TEST.CallIssueForm.SendToPrintCenterOnClick()", err);
}
}; //end SendToPrintCenterOnClick