2011-05-25 49 views
0

我需要使用Javascript獲取父主題。我如何獲得所有的一級父科目?邏輯應該是當parentubject爲'null'時。爲此我寫了以下查詢。如何在Dynamics CRM 4.0中的JavaScript中傳遞空值?

 
var message = 
    [ 
     "<?xml version='1.0' encoding='utf-8'?>", 
     "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema">", 
     GenerateAuthenticationHeader(), 
     "<soap:Body>", 
     "<RetrieveMultiple xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">", 
     "<query xmlns:q1='http://schemas.microsoft.com/crm/2006/Query' >xsi:type='q1:QueryExpression' >", 
     "<q1:EntityName>subject</q1:EntityName>", 
     "<q1:ColumnSet xsi:type=\"q1:ColumnSet\" >", 
     "<q1:Attributes>", 
     "<q1:Attribute>subjectid</q1:Attribute>", 
     "</q1:Attributes>", 
     "</q1:ColumnSet>", 
     "<q1:Criteria>", 
     "<q1:FilterOperator >And</q1:FilterOperator>", 
     "<q1:Conditions>", 
     "<q1:Condition>", 
     "<q1:AttributeName >parentsubject</q1:AttributeName>", 
     "<q1:FilterOperator>Equal</q1:FilterOperator>", 
     "<q1:Values>", 
     "<q1:Value xsi:type='xsd:string'>" _____________ "</q1:Value>", 
     "</q1:Values>", 
     "</q1:Condition>", 
     "</q1:Conditions>", 
     "</q1:Criteria>", 
     "</query>", 
     "</RetrieveMultiple>", 
     "</soap:Body>", 
     "</soap:Envelope>" 
    ].join(""); 

請讓我知道我應該怎麼傳遞_ __ _ ___

在此先感謝 JK

回答

0

FilterOperator應該是運營商,平等應該是零,而刪除值節點。所以:

"<q1:Condition>", 
"<q1:AttributeName >parentsubject</q1:AttributeName>", 
"<q1:FilterOperator>Equal</q1:FilterOperator>", 
"<q1:Values>", 
"<q1:Value xsi:type='xsd:string'>" _____________ "</q1:Value>", 
"</q1:Values>", 
"</q1:Condition>", 

應該

"<q1:Condition>", 
"<q1:AttributeName >parentsubject</q1:AttributeName>", 
"<q1:Operator>Null</q1:Operator>", 
"</q1:Condition>", 
+0

你能不能也請告訴我,我怎樣才能使一個for循環在JavaScript中獲取的所有記錄後? – 2011-05-25 15:53:13

相關問題