web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Processing the results of a SOAP Execute message into JavaScript objects representing the returned entities

(0) ShareShare
ReportReport
Posted on by 2

Hi all

This seems like it should've been done a thousand times, yet I'm not finding any good examples? Or maybe I'm searching for the wrong things...

Essentially, I execute aExecuteQuickFind request, and need to parse the results into usable JavaScript objects representing the returned entity records.

Request:

<request xmlns:a="schemas.microsoft.com/.../Contracts">
 <a:Parameters xmlns:b="schemas.datacontract.org/.../System.Collections.Generic">
  <a:KeyValuePairOfstringanyType>
   <b:key>SearchText</b:key>
   <b:value i:type="c:string" xmlns:c="www.w3.org/.../XMLSchema">test</b:value>
  </a:KeyValuePairOfstringanyType>
  <a:KeyValuePairOfstringanyType>
   <b:key>EntityNames</b:key>
   <b:value i:type="c:ArrayOfstring" xmlns:c="schemas.microsoft.com/.../Arrays">
    <c:string>account</c:string>
    <c:string>contact</c:string>
   </b:value>
  </a:KeyValuePairOfstringanyType>
 </a:Parameters>
 <a:RequestId i:nil="true" />
 <a:RequestName>ExecuteQuickFind</a:RequestName>
</request>

And I get back the following response: 

 <s:Body>
  <ExecuteResponse xmlns="schemas.microsoft.com/.../Services">
   <ExecuteResult xmlns:a="schemas.microsoft.com/.../Contracts" xmlns:i="www.w3.org/.../XMLSchema-instance">
    <a:ResponseName>ExecuteQuickFind</a:ResponseName>
    <a:Results xmlns:b="schemas.datacontract.org/.../System.Collections.Generic">
     <a:KeyValuePairOfstringanyType>
      <b:key>Result</b:key>
      <b:value i:type="a:QuickFindResultCollection">
       <a:QuickFindResult>
        <a:Data>
         <a:Entities/>
         <a:EntityName>account</a:EntityName>
         <a:MinActiveRowVersion>-1</a:MinActiveRowVersion>
         <a:MoreRecords>false</a:MoreRecords>
         <a:PagingCookie/>
         <a:TotalRecordCount>-1</a:TotalRecordCount>
         <a:TotalRecordCountLimitExceeded>false</a:TotalRecordCountLimitExceeded>
        </a:Data>
        <a:ErrorCode>0</a:ErrorCode>
        <a:QueryColumnSet xmlns:c="schemas.microsoft.com/.../Arrays" i:nil="true"/>
       </a:QuickFindResult>
       <a:QuickFindResult>
        <a:Data>
         <a:Entities>
          <a:Entity>
           <a:Attributes>
            <a:KeyValuePairOfstringanyType>
             <b:key>fullname</b:key>
             <b:value xmlns:c="www.w3.org/.../XMLSchema" i:type="c:string">A TEST</b:value>
            </a:KeyValuePairOfstringanyType>
            <a:KeyValuePairOfstringanyType>
             <b:key>emailaddress1</b:key>
             <b:value xmlns:c="www.w3.org/.../XMLSchema" i:type="c:string">atest@testemail.com</b:value>
            </a:KeyValuePairOfstringanyType>
            <a:KeyValuePairOfstringanyType>
             <b:key>contactid</b:key>
             <b:value xmlns:c="schemas.microsoft.com/.../Serialization" i:type="c:guid">********-****-****-****-************</b:value>
            </a:KeyValuePairOfstringanyType>
            <a:KeyValuePairOfstringanyType>
             <b:key>entityimage_url</b:key>
             <b:value xmlns:c="www.w3.org/.../XMLSchema" i:type="c:string">/Image/download.aspx?Entity=contact&amp;Attribute=entityimage&amp;Id=********-****-****-****-************&amp;Timestamp=636419355553591067</b:value>
            </a:KeyValuePairOfstringanyType>
           </a:Attributes>
           <a:EntityState i:nil="true"/>
           <a:FormattedValues/>
           <a:Id>********-****-****-****-************</a:Id>
           <a:KeyAttributes xmlns:c="schemas.microsoft.com/.../Contracts"/>
           <a:LogicalName>contact</a:LogicalName>
           <a:RelatedEntities/>
           <a:RowVersion i:nil="true"/>
          </a:Entity>
          <a:Entity>
           <a:Attributes>
            <a:KeyValuePairOfstringanyType>
             <b:key>fullname</b:key>
             <b:value xmlns:c="www.w3.org/.../XMLSchema" i:type="c:string">Another TEST</b:value>
            </a:KeyValuePairOfstringanyType>
            <a:KeyValuePairOfstringanyType>
             <b:key>emailaddress1</b:key>
             <b:value xmlns:c="www.w3.org/.../XMLSchema" i:type="c:string">anothertest@testemail.com</b:value>
            </a:KeyValuePairOfstringanyType>
            <a:KeyValuePairOfstringanyType>
             <b:key>contactid</b:key>
             <b:value xmlns:c="schemas.microsoft.com/.../Serialization" i:type="c:guid">********-****-****-****-************</b:value>
            </a:KeyValuePairOfstringanyType>
           </a:Attributes>
           <a:EntityState i:nil="true"/>
           <a:FormattedValues/>
           <a:Id>********-****-****-****-************</a:Id>
           <a:KeyAttributes xmlns:c="schemas.microsoft.com/.../Contracts"/>
           <a:LogicalName>contact</a:LogicalName>
           <a:RelatedEntities/>
           <a:RowVersion i:nil="true"/>
          </a:Entity>
         </a:Entities>
         <a:EntityName>contact</a:EntityName>
         <a:MinActiveRowVersion>-1</a:MinActiveRowVersion>
         <a:MoreRecords>true</a:MoreRecords>
         <a:PagingCookie>***Removed***</a:PagingCookie>
         <a:TotalRecordCount>-1</a:TotalRecordCount>
         <a:TotalRecordCountLimitExceeded>false</a:TotalRecordCountLimitExceeded>
        </a:Data>
        <a:ErrorCode>0</a:ErrorCode>
        <a:QueryColumnSet xmlns:c="schemas.microsoft.com/.../Arrays" i:nil="true"/>
       </a:QuickFindResult>
      </b:value>
     </a:KeyValuePairOfstringanyType>
    </a:Results>
   </ExecuteResult>
  </ExecuteResponse>
 </s:Body>

I need some representation of the return "account" and "contact" records that preserves their data types as much as possible. 

Any help would be much appreciated!
James 

*This post is locked for comments

I have the same question (0)
  • Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    Why don't you use CRM 2016 webapi? This is the way you should be querying CRM data now.

  • James Profile Picture
    2 on at

    Thanks Aric - this would be first prize, but I can't see how to do the ExecuteQuickFind using WebAPI? Could you provide a link or an example? I did look into using the SaveQuery via WebAPI, but I can't see how to pass any additional parameters (e.g. the search term) to them?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans