Hello Everyone and thanks for reading this in advance.
I am running into an issue setting up signature pads in our Microsoft 365 Dynamic CRM. I have read many articles here and in Microsoft website, but failed when applied any of the solutions and was wondering if an expert can help me figure what am I missing?
First of all the signature pads I am using is Topaz System. I have implemented the signature pad and is functional and working great only issue is when I click on accept button. window.close(); in JS does not close the window.
to give you a better understanding we have a signature web resource that is defined to be included in all entities that need to be signed. all entities with signature require have a button as "Sign Here" (another web resource) which is an html with a function in it to open "SignaturePad.html". Code below:
<html>
<head></head>
<body style="background-color: rgb(255, 255, 255); overflow-wrap: break-word;">
<div style="width: 247px;">
<input id="SignButton" onclick="openSignaturePad()" type="button" value="Sign Here"><br>
</div>
<script>
function openSignaturePad()
{
window.parent.Xrm.Utility.openWebResource("SignaturePad.html", null, 450, 250);
}
</script>
</body>
</html>
This will open our signature pad canvas "SignaturePad.html" (main signature window) with 3 button functionality.
1- Sign (When clicked they can start signing on signature pad)
2- Clear (If they click it will clear signature pad)
3- Accept ( if they click system grabs entity name of the form followed by "_signature" followed by generated Str of signature and then close the window )
in step 3 when this process is done it should close the window as mentioned but it fails to do so. for better understanding here is JS of Accept button:
function saveSignature()
{
if(NumberOfTabletPoints() == 0)
{
alert("Please sign before continuing");
}
else
{
SetTabletState(0, tmr);
SetSigCompressionMode(1);
//RETURN BMP BYTE ARRAY CONVERTED TO BASE64 STRING
SetImageXSize(396);
SetImageYSize(110);
SetImagePenWidth(5);
GetSigImageB64(SigImageCallback);
var entityName = opener.Xrm.Page.data.entity.getEntityName();
var splitEntityName = entityName.split("_");
entityPrefix = splitEntityName[0];
opener.Xrm.Page.getAttribute(entityPrefix + "_signature").setValue(topazSigData);
window.close();
//parent.window.close();
//alert("Signature Completed You Can Safely Close This Window");
}
}
I tried the parnt.window.close(); as it was mentioned in another trend but did not work.
where I am confused is when click on "sign here" and run the function "window.parent.xrm" does that suppose to make "SignaturePad.html" as a parent, if yes why window.close() in "SignaturePad.html" does not work?
any help will be much appreciated.