您如何在Dynamics CRM 2011中拥有多个JavaScript库 [英] How do you have multiple javascript libraries in Dynamics CRM 2011

查看:109
本文介绍了您如何在Dynamics CRM 2011中拥有多个JavaScript库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正确我正在创建一个方法,通过Ajax POST向Dynamics CRM添加一个帐户到内置的Web服务,代码如下:

Right I am creating a method which adds an Account to Dynamics CRM with an Ajax POST to a built in webservice, the code is as follows :

var context = GetGlobalContext();
var serverUrl = context.getServerUrl();
var ODATA_ENDPOINT = "/XRMServices/2011/OrganizationData.svc";

var account = new Object();
account.Name = "Sample Account created via OData jQuery library.";

// Parse the entity object into JSON
var jsonEntity = window.JSON.stringify(account);

// Asynchronous AJAX function to Create a CRM record using OData
$.ajax({ type: "POST",
    contentType: "application/json; charset=utf-8",
    datatype: "json",
    url: serverUrl + ODATA_ENDPOINT + "/AccountSet",
    data: jsonEntity,
    beforeSend: function (XMLHttpRequest) {
        //Specifying this header ensures that the results will be returned as JSON.
        XMLHttpRequest.setRequestHeader("Accept", "application/json");
    },
    success: function (data, textStatus, XmlHttpRequest) { },
    error: function (XMLHttpRequest, textStatus, errorThrown) { }
});

这段代码有一个指向JSON和JQuery库的链接,如何在动态CRM 2011中链接它们。

Right this code has a link to JSON and JQuery libraries, how do i link them in dynamic CRM 2011.

我希望在onload函数上执行代码来添加新帐户。但是我现在处于黑暗状态,这将如何发挥作用。

I am looking to execute the code on a onload function to add the new account. But am in the dark at the moment to how that will work.

我明白我必须先行:


  • 转到网络资源

  • 添加以上jquery

  • 保存文件

  • 转到我的实体并添加javascript库及其方法来调用onload

  • Go to web resources
  • Add the above jquery
  • save the file
  • Go to my entity and add the javascript library and its method to call on the onload

但它链接到json和jquery库虽然。这是如何工作的?

but it links to json and jquery libraries though. How does this work?

推荐答案

只需将这些库作为其他Web资源上传。在表单的自定义上,您可以选择在表单上加载哪些库。只需确保在自定义代码之前加载JSON和jQuery库,就可以了。

Just upload those libraries as additional Web Resources. On the customizations for the form, you can choose which libraries get loaded on the form. Just make sure your JSON and jQuery libraries are loaded before your custom code, and you should be fine.

这篇关于您如何在Dynamics CRM 2011中拥有多个JavaScript库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆