c# - CRM 2013 - 在 Javascript 中如何使用 FetchXML 查询

标签 c# javascript dynamics-crm-2013 fetchxml

我当前需要检索子网格中存在的属性,之前的做法是使用 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/

相关文章:

c# - 绑定(bind)到 List<string> 的 ComboBox 的 MemberValue 是什么?

c# - 是否可以在 .NET 4 中动态创建路由?

javascript - 镜像滚动效果开启。在两个容器之间单击

javascript - 将函数的响应发送到 expressjs 中的路由

dynamics-crm - 仅当我在 Dynamics crm 中更新浏览器时,字段才会更新

javascript - 动态 CRM 2013 : How to check whether an contact already got a connection to a record?

c# - HttpWebRequest 序列

c# - LINQ 外连接有重复项

javascript - 在 Mustache.js 中使用逻辑

dynamics-crm-2011 - Dynamics CRM 中的 Retrieve 和 RetrieveMultiple 有什么区别?