我当前需要检索子网格中存在的属性,之前的做法是使用 C# 插件,其中包含 FetchXML 查询来检索属性。
但是,我想检索该属性并将其上下文放入 CRM 表单上的字段中。因此,我在 JavaScript Web 资源中构建了以下内容
function getProduct()
{
var accountID = Xrm.Page.getAttribute("productid");
var AccountIDObj= accountID.getValue();
if (AccountIDObj!=null)
{
AccountID= AccountIDObj[0].id;
}
var fetch =
"@<fetch distinct='false' mapping='logical' output-format='xml-platform' version='1.0'>
<entity name = 'quotedetail'>
<attribute name = 'productid'/>
<attribute name = 'productdescription'/>
<attribute name = 'priceperunit'/>
<attribute name = 'quantity'/>
<attribute name = 'extendedamount'/>
<attribute name = 'quotedetailid'/>
<link-entity name ='product' alias='bf' to='productid' from='productid'>
<filter type = 'and'>
<condition attribute='productnumber' value ='" + AccountID + "' operator = 'eq'/>
</filter>
<link-entity name='productpricelevel' alias='bg' to='productid' from ='productid'>
<attribute name = 'amount'/>
</link-entity>
</link-entity>
</entity>
</fetch>"
我现在遇到的问题是从这里去哪里,在 C# 中,我将使用查询创建一个 EntityCollection 并从那里开始,有人有任何建议吗?
最佳答案
要使用 Javascript 在客户端执行 FetchXml 查询,您可以使用以下库
XrmServiceToolKit.js http://xrmservicetoolkit.codeplex.com/wikipage?title=Soap%20Functions
CrmFetchKit.js https://crmfetchkit.codeplex.com/documentation
祝你编码愉快:-)
关于c# - CRM 2013 - 在 Javascript 中如何使用 FetchXML 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25445244/