简体   繁体   English

如何使用 JavaScript 获取 Dynamics CRM Web 资源名称

[英]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.

相关问题 Dynamics CRM 2015:如何获得创建的Web资源按钮以引用添加到表单的Javascript库中的函数? - Dynamics CRM 2015: How do I get a Web Resource button I created to reference a function in a Javascript Library I added to the form? Dynamics CRM-调用JavaScript资源 - Dynamics CRM - call javascript resource 在 Dynamics CRM Online 中获取 HTML Web 资源的价值 - Get value into HTML web resource in Dynamics CRM Online 如何从Microsoft Dynamics CRM表单到html Web资源获取价值 - how to get value from microsoft dynamics crm form to html web resource Dynamics CRM:JavaScript GET请求未使用Web.Api检索记录 - Dynamics CRM: JavaScript GET request is not retrieving records using Web.Api Dynamics CRM 2011网站资源没有在Chrome中显示? - Dynamics CRM 2011 web resource not showing in Chrome? 是否可以在Dynamics CRM中显示Web资源的导航栏? - Is it possible to show navbar for a web resource in Dynamics CRM? 如何在Dynamics CRM中使用javascript查找有关实体视图的名称和信息 - How to find name and information about views of entity using javascript in dynamics crm Dynamics CRM - 如何在 Javascript Web 资源中使用 JQuery - Dynamics CRM - How to use JQuery in a Javascript Web ressource 如何使用JavaScript在Dynamics CRM的子网格中获取活动列表? - How can i get the active list in a subgrid in Dynamics CRM using javascript?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM