简体   繁体   English

如何在CRM Dynamics中使用外部Javascript库?

[英]How do I use an external Javascript library in CRM Dynamics?

I'll be doing some REST-ing and oData-ing so I got the executable from DataJS project . 我将进行一些REST-ing和oData-ing,因此我从DataJS project获得了可执行文件。 I've added the file datajs-1.0.3.min.js as a web resource and my own qwerty.js as another one. 我添加了datajs-1.0.3.min.js文件作为网络资源,并添加了自己的qwerty.js文件作为网络资源。 So, I've ended up with two web resources called: 因此,我最终得到了两个名为的网络资源:

  1. CRMKonsulterna_MyOwnStuff CRMKonsulterna_MyOwnStuff
  2. CRMKonsulterna_TheCoolStuff CRMKonsulterna_TheCoolStuff

The problem is now that when I execute the code snippet below from web resource 1 that I've found on their site , I get a crash telling me that: 现在的问题是,当我从在其站点上找到的Web资源1执行下面的代码片段时,发生崩溃,告诉我:

Field: window 栏位:视窗

Event: onload 事件:onload

Error: 'OData' is undefined 错误:“ OData”未定义

var shazoo = function () {

  alert("Commenced...");

  OData.read(
    "http://services.odata.org/Northwind/Northwind.svc/Categories",
    function (data) {
      var html = "";
        $.each(data.results, function (l) { 
          html += "<div>" + l.CategoryName + "</div>";
        });
        $(html).appendTo($("#target-element-id"));
    }
  );

  alert("Completed.");

}

How can I refer from a method inside web resource 1 to a method inside web resource 2? 如何从Web资源1中的方法引用到Web资源2中的方法? I've found this discussion but it didn't give me much. 我已经找到了这个讨论,但是并没有给我太多好处。 I can't even tell if it's helpful if one understand what they're talking about. 我甚至不能告诉我们,如果如果一个人明白他们在说什么这是有帮助的。

EDIT 编辑

I've made some changes and went for trying if OData is known to my method like this. 我已经进行了一些更改,然后尝试尝试这样的方法是否知道OData

alert(OData);

Expecting a null value, I was surprised to discover that it gave me {Object object} instead. 期望为null值,我惊讶地发现它给了我{Object object}。 So, I'm guessing the connection between web resources is made. 因此,我猜想Web资源之间已建立连接。 Is it so? 是这样吗? Also, still, how can I make the call to get me some oData formatted data?! 而且,仍然如何打电话给我一些oData格式的数据?

Have you added both libraries to the entity? 您是否已将两个库都添加到实体? It's not sufficient to add them only as web resources. 仅将它们添加为Web资源是不够的。

  1. Settings -> Solution -> 设置->解决方案->
  2. {pick the solution} -> or Customizations -> Customize the System -> {选择解决方案}-> 自定义->自定义系统->
  3. Components -> Entities -> {pick the entity} -> Forms -> {pick the form type} 组件->实体-> {选择实体}->表单-> {选择表单类型}
  4. Form properties -> Form Libraries 表单属性->表单库

声明:本站的技术帖子网页,遵循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 Web 资源中使用 JQuery - Dynamics CRM - How to use JQuery in a Javascript Web ressource 您如何在Dynamics CRM 2011中拥有多个JavaScript库 - How do you have multiple javascript libraries in Dynamics CRM 2011 如何在Dynamics CRM中将外部源打开为对话框 - How to open external source as dialog in Dynamics CRM 来自外部站点的Dynamics CRM Web API(JavaScript) - Dynamics CRM Web API from external site (javascript) 如何使用外部Javascript库(如jQuery)重命名Google Closure样式表? - How do I use Google Closure Stylesheet renaming with an external Javascript Library such as jQuery? 如何使用AngularJS控制器进行Dynamics CRM开发 - How to use AngularJS Controller for Dynamics CRM development Dynamics CRM JavaScript 平均值 - Dynamics CRM JavaScript Average 如何在 vaadin 中使用外部 javascript 库? - how can i use an external javascript library in vaadin? 如何向 Webpack 添加外部 javascript 库? - How do I add an external javascript library to Webpack?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM