AnsweredAssumed Answered

Combine Multiple Incoming Documents Based on Condition

Question asked by vvelpula087283 on Oct 25, 2017
Latest reply on May 3, 2018 by jloyola077960

Hi Guys,

We have a requirement where we have to combine multiple incoming documents based on a condition (same order number). The number of outgoing documents will be as many as there are order numbers. I am struggling to get this to work.

Here is a basic profile of two incoming XML document (simplified). This process will be a nightly sync and we will have around 385K individual documents of the below profile coming in:

Document 1:

<Commission_Credit_Staging__c>
<Id>a3718000000</Id>
<Name>ABCD</Name>
<Commission_Credit_ID__c>RtyC6EAJ</Commission_Credit_ID__c>
<Commission_Sequence__c>16384</Commission_Sequence__c>
<Credit_Type__c>Core</Credit_Type__c>
<Deliverable_Credit_Percent__c>100.0</Deliverable_Credit_Percent__c>
<Deliverable_ID__c>MvmAAR</Deliverable_ID__c>
<Deliverable_Sequence__c>49352</Deliverable_Sequence__c>
<ERP_Dex_ID__c>170720</ERP_Dex_ID__c>
<Opportunity_ID__c>0INXAA5</Opportunity_ID__c>
<Order_Number__c>140</Order_Number__c>
<Sales_Rep__c>3257-105</Sales_Rep__c>
</Commission_Credit_Staging__c>

Document 2:
<Commission_Credit_Staging__c>
<Id>000NAzkAAG</Id>
<Name>XYZ</Name>
<Commission_Credit_ID__c>a0T5000</Commission_Credit_ID__c>
<Commission_Sequence__c>32768</Commission_Sequence__c>
<Credit_Type__c>Core</Credit_Type__c>
<Deliverable_Credit_Percent__c>100.0</Deliverable_Credit_Percent__c>
<Deliverable_ID__c>MvgBIAAZ</Deliverable_ID__c>
<Deliverable_Sequence__c>49152</Deliverable_Sequence__c>
<ERP_Dex_ID__c>170718</ERP_Dex_ID__c>
<Opportunity_ID__c>0INXAA5</Opportunity_ID__c>
<Order_Number__c>140</Order_Number__c>
<Sales_Rep__c>32574-00105</Sales_Rep__c>
</Commission_Credit_Staging__c>

Here is what the out going document should be:

<eConnect xmlns="http://tempuri.org/taPbsCustRelInsUpd.xsd">
<RMCustomType>
<taPbsLineSalesRepCommissionSplit>
<orderNumber>140</orderNumber>
<SequenceNumber>65536</SequenceNumber>
<lineSalesCommsplitSequence>16384</lineSalesCommsplitSequence>
<lineSalesCommsplitCreateflag>1</lineSalesCommsplitCreateflag>
<SLPRSNID>30742-00089</SLPRSNID>
<SALESTERRITORYID>FOUNDATION</SALESTERRITORYID>
<COMPRCNT>0</COMPRCNT>
<COMMAMNT>0</COMMAMNT>
<PRCTOSAL>100.0</PRCTOSAL>
<CUSTNMBR />
</taPbsLineSalesRepCommissionSplit>
<WMDComExtIns>
<orderNumber>140</orderNumber>
<SequenceNumber>65536</SequenceNumber>
<lineSalesCommsplitSequence>16384</lineSalesCommsplitSequence>
<CommissionType>Core - Channel</CommissionType>
</WMDComExtIns>
<taPbsLineSalesRepCommissionSplit>
<orderNumber>140</orderNumber>
<SequenceNumber>65536</SequenceNumber>
<lineSalesCommsplitSequence>32768</lineSalesCommsplitSequence>
<lineSalesCommsplitCreateflag>1</lineSalesCommsplitCreateflag>
<SLPRSNID>30000-00084</SLPRSNID>
<SALESTERRITORYID>PHARMA</SALESTERRITORYID>
<COMPRCNT>0</COMPRCNT>
<COMMAMNT>0</COMMAMNT>
<PRCTOSAL>100.0</PRCTOSAL>
<CUSTNMBR />
</taPbsLineSalesRepCommissionSplit>
<WMDComExtIns>
<orderNumber>140</orderNumber>
<SequenceNumber>65536</SequenceNumber>
<lineSalesCommsplitSequence>32768</lineSalesCommsplitSequence>
<CommissionType>Core</CommissionType>
</WMDComExtIns>
</RMCustomType>
</eConnect>

To keep this brief I haven't mapped all the incoming fields to the outgoing ones. But if you notice the two structures (incoming document vs outgoing), the fields from each incoming document are mapped into two nodes on the outgoing document i.e., <taPbsLineSalesRepCommissionSplit> and <WMDComExtIns> and these two nodes will repeat within that same outgoing document as long as the orderNumber is same. If the orderNumber is different the Boomi process should begin to construct another outgoing document. Suffice to say that the incoming documents will be ordered so that documents belonging to the same order are contiguous.

Looking forward to your suggestions.

Thanks in advance.

Outcomes