繁体   English   中英

CRM 2013-使用JavaScript中的FetchXML查询做什么

[英]CRM 2013 - What to do with FetchXML Query In Javascript

目前,我需要检索子网格中存在的属性,以前我是如何做到的是在其中带有FetchXML查询的C#插件中检索该属性。

但是,我想检索属性并将其上下文放入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查询,可以使用以下库

XrmServiceToolKitKit.js http://xrmservicetoolkit.codeplex.com/wikipage?title=Soap%20Functions

CrmFetchKit.js https://crmfetchkit.codeplex.com/documentation

快乐编码:-)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM