窗口.close();在我的 JS 中,无法使用 Microsoft Dynamic Crm window.parent.xrm

发布于 2025-01-14 21:50:58 字数 2087 浏览 2 评论 0原文

大家好,感谢您提前阅读本文。

我在 Microsoft 365 Dynamic CRM 中设置签名板时遇到问题。我在这里和 Microsoft 网站上阅读了很多文章,但在应用任何解决方案时都失败了,想知道专家是否可以帮助我弄清楚我错过了什么?

首先,我使用的签名板是Topaz System。我已经实现了签名板,并且功能正常且运行良好,唯一的问题是当我单击“接受”按钮时。窗口.close();在JS中并没有关闭窗口。

为了让您更好地理解,我们有一个签名 Web 资源,它被定义为包含在所有需要签名的实体中。 所有具有签名的实体都需要有一个“Sign Here”(另一个网络资源)按钮,该按钮是一个 html,其中包含打开“SignaturePad.html”的功能。代码如下:

<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>

这将打开我们的签名板画布“SignaturePad.html”(主签名窗口),具有 3 个按钮功能。

1- 签名(单击时,他们可以开始在签名板上签名)

2- 清除(如果单击,将清除签名板)

3- 接受(如果单击,系统会获取表单的实体名称,后跟“_signature”,后跟生成的 Str签名,然后关闭窗口)

在步骤 3 中,当此过程完成时,它应该如上所述关闭窗口,但它未能这样做。为了更好地理解这里是 Accept 按钮的 JS:

  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");
    }
  }

我尝试了 parnt.window.close();正如在另一个趋势中提到的那样,但没有起作用。

我感到困惑的是,当单击“在此处签名”并运行函数“window.parent.xrm”时,是否会将“SignaturePad.html”作为父级,如果是,为什么在“SignaturePad.html”中使用window.close() “不行吗?

任何帮助将不胜感激。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文