How to use the Batch Results Option on SFDC Query Operations

Document created by chris_stevens Employee on Mar 21, 2016Last modified by chris_stevens Employee on Apr 19, 2016
Version 2Show Document
  • View in full screen mode

When selecting  Batch Results on a Salesforce query, an XML file is generated.  This XML file MAY or MAY NOT contain data. This depends on whether or not the query results in records (which match those query parameters) being returned from Salesforce.

 

Either way, when this batched document flows to a map within the Process, it may generates a "no data produced from map" error message.

 

 

Let's assume the Batch Results option is selected:

 

 

The Batch Results option on a SFDC query operation changes the XML format of the data being returned in the query.  For example, let's assume we have 2 Documents that meet our query parameters.  If the Batch Results option is NOT checked, we would see the individual Documents being retrieved, having a structure similar to:

 

Document #1:

<Account>
     <Name></Name>
     <Phone></Phone>
</Account>

 

Document #2:

<Account>
     <Name></Name>
     <Phone></Phone>
</Account>

 

If the Batch Results option IS checked, we would see the 2 Documents combined (or batched) within 1 returned Document and would have an XML structure similar to:

Batched Document:

<AccountList>
     <Account>
          <Name></Name>
          <Phone></Phone>
     </Account>
     <Account>
          <Name></Name>
          <Phone></Phone>
     </Account>
</AccountList>

 

Notice the </AccountList> wrapper element.  Where this causes an issue, is that the Salesforce profile most likely loaded (and expected) in the Map replicates the XML format represented in 1 of the Documents (Document #1 or Document #2) listed above and NOT the Batched Document.  Thus, the profile probably doesn't contain the newly formed <AccountList> element.

 

To correct this you can either modify the existing Salesforce source profile in the Map or create a new source profile in the Map that replicates this new batched structure, including the <AccountList></AccountList> element.

 

 

NOTE:  When the Batch Results option is checked and no data is returned by the query, an XML document is still created with just the wrapper tags of the XML. For example, the following document may be generated:

 

<?xml version="1.0" encoding="UTF-8"?>

<AccountList  />

 

 

This is most likely because there were no records that matched the query parameters in the operation.

 

ALTERNATE APPROACH: In lieu of using the Batch Document option, you may choose to take advantage of the 'Combine Documents' Process Type found within the Data Process Step.  Keep in mind, however, that you may still need to amend the Profile so that the proper 'Combine Element' is selected.

3 people found this helpful

Attachments

    Outcomes