簡體   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