[英]Fetching Record from CRM 2011 using jQuery/javascript
I am trying to get data from CRM 2011 through jQuery but I am unable to fetch the data. 我试图通过jQuery从CRM 2011中获取数据,但无法获取数据。 Here is my code:
这是我的代码:
function GetConfigurations() {
var oDataPath = Xrm.Page.context.getServerUrl() + "/xrmservices/2011/organizationdata.svc";
var filter = "/new_plugins_configurationSet?" +
"$top=1";
var dataUrl=oDataPath + filter;
alert(dataUrl);
try
{
$.ajax({url: dataUrl, success: function(result){
alert(result);
},error:function(error){console.log(error);alert("error");}});
}
catch(err)
{
alert("error" + err.message);
}
}
This gives me the following error in the console of the CRM form: 这使我在CRM表单的控制台中出现以下错误:
Am I doing something wrong in the code? 我在代码中做错了吗?
Edited : 编辑:
I have done changes in Js Code and now I am writing new_plugins_configurationset but it is returning Cross origin error even tough I am calling JS Code from CRM forms. 我已经在Js Code中进行了更改,现在正在编写new_plugins_configurationset,但是即使从CRM表单中调用JS Code,也很难返回跨源错误。
Here what I want to achieve is that on opening of one Entity CRM form, I want to read a second entity and put value in control of opening entity.
在这里,我要实现的是在打开一个实体CRM表单时,我想读取第二个实体并将值置于打开实体的控制之下。 that's why I am calling second entity using JS code.
这就是为什么我使用JS代码调用第二个实体。
The issue is with dataset name, it should end with Set
keyword. 问题在于数据集名称,它应该以
Set
关键字结尾。 For your entity it should be new_plugins_configurationSet
. 对于您的实体,它应该是
new_plugins_configurationSet
。
I have resolved my problem. 我已经解决了我的问题。 I was doing following mistakes through which I was unable to Get data from CRM.
我一直在追随无法从CRM获取数据的错误。
The issue was with dataset name, it should end with Set
keyword. 问题出在数据集名称上,应该以
Set
关键字结尾。 For my entity it should be new_plugins_configurationSet. 对于我的实体,它应该是new_plugins_configurationSet。
I was using Xrm.Page.context.getServerUrl();
我正在使用
Xrm.Page.context.getServerUrl();
method to get serverUrl but by using this it's returning Cross origin error, so I used Xrm.Page.context.getClientUrl()
to get complete server Url. 获取serverUrl的方法,但是使用此方法会返回跨源错误,因此我使用
Xrm.Page.context.getClientUrl()
来获取完整的服务器URL。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.