0

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.

  • [These folks](https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/381110/dynamics-crm-9-1---close-the-window-which-was-opened-using-xrm-navigation-openwebresource) are suggesting `window.top.close()`. Shrug. – James Mar 17 '22 at 19:16
  • Thanks @James, I tried this and it did not work, I am doing some research to find if I am putting window.close in right spot or not. Since it is critical to add this to the parent window that opened the html to begin with, although I believe I am still concern. – Pedram Salamati Mar 17 '22 at 22:24
  • Adding this just if someone else runs to my issue, What I have discovered is that if your JS has XMLhttpRequest in any form and respond you are trying to get is not back your window.close() will not work. in my case the version check of signature pad was getting checked by an XMLRequest. once I defined these requirements to be checked locally (driver installed check) the window.close() worked! :) – Pedram Salamati Mar 24 '22 at 20:25

0 Answers0