Topic
1 reply Latest Post - ‏2013-09-12T15:11:55Z by peachy
SwethaRai
SwethaRai
47 Posts
ACCEPTED ANSWER

Pinned topic Output of Upsert Objects Activity

‏2013-09-12T11:54:09Z |

Hi,

I am using a Split Activity to Upsert a batch of 200 records from Database to Salesforce.com. 

After upsert I need to update the Database back again with the resultstatus/message of upsert.

 

I am able to update the success records correctly. But for the failure records I am seeing issues with the 

Upsert output value for 'errors' which I am unable to map directly to the DB error field. 

 

Please suggest a workaround, to map all the errrors correctly for all the records in the batch (which have failed in the batch)

 

Thanks,

Swetha Rai

  • peachy
    peachy
    54 Posts
    ACCEPTED ANSWER

    Re: Output of Upsert Objects Activity

    ‏2013-09-12T15:11:55Z  in response to SwethaRai
    The output of the salesforce.com Upsert Objects operation is a positional set. The output results document will contain one instance of result per input "object". This also applies to results document produced by the  Insert, Update, and Delete Objects operations.
     
    In order to meaningfully handle results, you probably will need to positionally  merge the input (e.g., database key field(s)) with the output.  Unfortunately, the Data Quality Merge activity does not properly handle a merge based on the XPath position function. So, you will have to handle the merge yourself.  This can be done in a custom XSLT or web service; a brute force approach can use nested For Each loops.
     
    Once you have the merged set, you can filter "in" those that have a populated errors node and use the database key to update the database.
     
    BTW I have an open Request for Enhancement (#32160) related to the Data Quality Merge activity and the position function. If you think it would be useful, please vote.