[英]How to get Dynamics CRM Web Resource name using JavaScript
I'm working on a project.我正在做一个项目。 I want to get the name of web resource eg if I want to get entity name I use this query
我想获取网络资源的名称,例如,如果我想获取实体名称,我将使用此查询
var entityName = parent.Xrm.Page.data.entity.getEntityName();
var id = parent.Xrm.Page.data.entity.getId();
so in the same way how I can get the web resource name at this time, I am passing the web resource as a string.所以以同样的方式我此时如何获取网络资源名称,我将网络资源作为字符串传递。
getImages(entityName, id, "WebResource_webTest");
So can you tell me how i can get the web resoucre name.所以,你可以告诉我怎样可以得到网页resoucre名。
Here is the code snippet I just tried on one of my Entity and it gave me webresource name这是我刚刚在我的实体之一上尝试的代码片段,它给了我 webresource 名称
You can add this function on load on change and pass execution context as parameter to function您可以在更改加载时添加此函数并将执行上下文作为参数传递给函数
Note: If you have 5 webresources on your form you will get one by one all the webresource names.注意:如果您的表单上有 5 个网络资源,您将一一获得所有网络资源名称。 you can tweak/modify code as per your need.
您可以根据需要调整/修改代码。
function onChangeOfField(executionContext) {
debugger
var formContext = executionContext.getFormContext();
formContext.ui.controls.forEach(function(control, index) {
var controlType = control.getControlType();
if (controlType === "webresource" ) {
alert(control.getName());
}
});
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.