0
我已經在我們的CRM聯機實例中的窗體上添加了按鈕形狀的網頁資源。我一直在調試一段時間,我不明白我在這裏失去了什麼。窗體上的按鈕不通過所有JS
下面是網絡資源(我省略了顯而易見的原因的JavaScript URL)
<html>
<head>
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-
BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous">
</head>
<body>
<button onclick="TriggerNPS()" class=".btn-default">
<i class="glyphicon glyphicon-check"></i>
Send NPS Now
</button>
<script src="Javascript URL" type="text/javascript"></script>
</body>
</html>
的Javascript的URL鏈接
function TriggerNPS() {
var NoTick = parent.Xrm.Page.getAttribute("ondemandnps").getValue();
if ((NoTick) ==null);
parent.Xrm.Page.getAttribute("ondemandnps").setValue("1");
parent.Xrm.Page.data.entity.save();
return
if ((NoTick) !=null)
parent.Xrm.Page.getAttribute("ondemandnps").setValue("0");
parent.Xrm.Page.data.entity.save();
return;
}
我是什麼看到的是,如果這是正在查看的字段(複選框)包含數據,那麼確定它剝離了抽動。但是,如果該框是空的。我無法使腳本添加檢查。通過命令確實可以在控制檯中進行測試。它在線上運行,並沒有離開它們,但什麼都不做。
任何幫助將不勝感激。
你確定你是*作用域*你的代碼嗎?當外部條件範圍時,JS不會將指令與條件相關聯,即使它是如此縮進。 –
你應該能夠使用相對路徑來引用你的JS。這樣做的話,您不應該在這裏隱藏URL或在將解決方案部署到其他環境時進行更改。 https://msdn.microsoft.com/en-us/library/gg309414.aspx#Referencing%20a%20script%20web%20resource%20from%20a%20webpage%20web%20resource –