如何从MSCRM 2011中的另一个实体检索字段的值? [英] how to retrieve a field's value from another entity in MSCRM 2011?
本文介绍了如何从MSCRM 2011中的另一个实体检索字段的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以使用 CRMToolsODataQueryDesigner 来进行这样有用的 odata 查询 但是我被困在如何从表单的特定字段中获取价值.
I was able to buld such useful odata queryies by using CRMToolsODataQueryDesigner however I'm stuck how can I get value from a particular field of a form.
例如,我进行下一个 odata 查询
for instance, I make the next odata query
http://ServerName/Organization/xrmservices/2011/OrganizationData.svc/AccountSet?$filter=TypeCode/Value eq '121'
因此,我以这种方式找到了一个与特定帐户有关的注释. 下一步,我想知道如何获取该帐户中特定字段的值.
so, in such way, I found a one note that relates to particular account. The next step, I wonder how can I get a value of a particular field in that account.
提前感谢
我尝试过类似的事情:
var oDataPath = "http:/ServerName/Organization/xrmservices/2011/OrganizationData.svc/AccountSet?$filter=Name eq 'Sample'";
var retrieveRecordsReq = new XMLHttpRequest();
retrieveRecordsReq.open("GET", oDataPath + filter, true);
retrieveRecordsReq.setRequestHeader("Accept", "application/json");
retrieveRecordsReq.setRequestHeader("Content-Type", "application/json; charset=utf-8");
retrieveRecordsReq.onreadystatechange = function () {
if (this.readyState == 4) {
if (this.status == 200) {
var retrievedRecords = JSON.parse(retrieveRecordsReq.responseText).d;
var vehicle = Xrm.Page.data.entity.attributes.get("new_address1").getValue();
alert(vechicle);
}
}
};
retrieveRecordsReq.send();
此步骤遇到的问题:
"var vehicle = Xrm.Page.data.entity.attributes.get("new_address1").getValue();"
在这里,我想获取特定字段的值
here, I'd like to get a value of a particular field
推荐答案
尝试:
var vehicle = retrievedRecords.results[0].new_Address1;
这篇关于如何从MSCRM 2011中的另一个实体检索字段的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文