[英]Micrsoft Dynamics CRM: Facing troubling while executing js web resouce for crm button
I created a button in an account form entity by ribbon workbench and then I tried to create a javascript code.我通过功能区工作台在帐户表单实体中创建了一个按钮,然后我尝试创建一个 javascript 代码。 When executed the code is just fetching the account id and showing that id in the alert and then I registered that file to that button by ribbon workbench action command.
执行时,代码只是获取帐户 ID 并在警报中显示该 ID,然后我通过功能区工作台操作命令将该文件注册到该按钮。 I wrote the below code, please let me know what is wrong with that.
我写了下面的代码,请让我知道它有什么问题。
I am expecting an alert box with that id, but nothing is happening我期待一个带有该 ID 的警告框,但什么也没有发生
The code is below:代码如下:
fetch = {
fetchingacountid: function(executionContext){
var formContext = Xrm.Page.context.getFormContext();
var accountId = formContext.data.entity.getId();
alert("The ID of the current account is: " + accountId);
}
}
Possibly you might have missed to add the PrimaryControl
CRM parameter in ribbon command.您可能错过了在功能区命令中添加
PrimaryControl
CRM 参数。 Then you don't need Xrm.Page
, instead you will get the context directly in the first parameter executionContext
.然后你不需要
Xrm.Page
,而是直接在第一个参数executionContext
中获取上下文。 Read more 阅读更多
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.