2016-10-12 32 views
0

我想從html網頁資源中使用javascript獲得fetchxml的值。我使用crm 2015.代碼塊位於picture的附件中。Crm 2015 Javascript上下文沒有從fetchxml中定義

在fetchxml之後,我嘗試使用soap函數獲取值。 它給我的錯誤

Error: Contex is not available

我加入了xrmservicetoolkit對CRM 2015和jQuery和JSON文件。問題是什麼?我該如何解決這個問題?任何人都可以幫助我嗎?

var fetch = "<fetch version='1.0' mapping='logical'><entity name='quote'>"; 
    fetch += "<all-attributes />"; 
    fetch += "<filter type='and'>"; 
    fetch += "<condition attribute='new_anabayi' operator='eq' value='" + id + "' />"; 
    fetch += "<condition attribute='statuscode' operator='eq' value='1' />"; 
    fetch += "<condition attribute='customertypecode' operator='eq' value='7' />"; 
    fetch += "</filter></entity></fetch>"; 

var fetchData = XrmServiceToolkit.Soap.Fetch(fetch); 
+1

請將您的代碼添加爲*文本*,而不是屏幕截圖 –

+1

請參閱[問]和[mcve]。 – Mat

回答

3

在您的網站上添加對ClientGlobalContext.js的引用。

<script src="ClientGlobalContext.js.aspx" type="text/javascript"></script> 

我假設你已經引用了下面的腳本呢?

<script type="text/javascript" src="jquery.js"></script> 
<script type="text/javascript" src="json2.js"></script> 
<script type="text/javascript" src="XrmServiceToolkit.js"></script> 
相關問題