Thursday, May 1, 2014

eConnect error: All transaction type child nodes must contain the same document number

By Steve Endow

I developed a new eConnect GL JE import for a customer and during an initial test, it worked fine.

But during a subsequent test with a new sample data file, the customer would receive the following eConnect message:

All transaction type child nodes must contain the same document number. Please ensure your transaction is not missing this unique identifier for the element JRNENTRY. (If you would like the document number generated, please ensure a document number value is not contained in the document number element JRNENTRY.)

The journal entry would import into Dynamics GP properly, despite the error.  I don't recall ever seeing this error before, so I was puzzled.  I first checked the serialized XML that was being generated, and it looked fine.

< ?xml version=\"1.0\"? >
< eConnect xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" >
< GLTransactionType >
< eConnectProcessInfo xsi:nil=\"true\" / >
< taRequesterTrxDisabler_Items xsi:nil=\"true\" / >
< taGLTransactionLineInsert_Items >
< taGLTransactionLineInsert >
< BACHNUMB >CMS30< /BACHNUMB >
< JRNENTRY >24440< /JRNENTRY >
< CRDTAMNT >0.00< /CRDTAMNT >
< DEBITAMT >170618104.45< /DEBITAMT >
< ACTNUMST >999-9999-99< /ACTNUMST >
< DSCRIPTN >Contr< /DSCRIPTN >
< /taGLTransactionLineInsert >
< taGLTransactionLineInsert >
< BACHNUMB >CMS30< /BACHNUMB >
< JRNENTRY >24440< /JRNENTRY >
< CRDTAMNT >170618104.45< /CRDTAMNT >
< DEBITAMT >0.00< /DEBITAMT >
< ACTNUMST >999-9999-99< /ACTNUMST >
< DSCRIPTN >Contr< /DSCRIPTN >
< /taGLTransactionLineInsert >
< /taGLTransactionLineInsert_Items >
< taAnalyticsDistribution_Items xsi:nil=\"true\" / >
< taGLTransactionHeaderInsert >
< BACHNUMB >CMS30< /BACHNUMB >
< JRNENTRY >24440< /JRNENTRY >
< REFRENCE >CMS Contr 04/23/2014< /REFRENCE >
< TRXDATE >04/23/2014< /TRXDATE >
< TRXTYPE >0< /TRXTYPE >
< /taGLTransactionHeaderInsert >
< taMdaUpdate_Items xsi:nil=\"true\" / >
< /GLTransactionType >
< /eConnect >


I was puzzled.  I then pulled up another eConnect GL import I had developed to see if I was missing anything in the XML--but the XML structure was identical.

But after another round of tests, I found that the first JE imported fine, but the second and subsequent JEs received the eConnect error.  Hmmm.

So here is the XML for the second JE.  Notice anything wrong?

< ?xml version=\"1.0\"? >
< eConnect xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" >
< GLTransactionType >
< eConnectProcessInfo xsi:nil=\"true\" / >
< taRequesterTrxDisabler_Items xsi:nil=\"true\" / >
< taGLTransactionLineInsert_Items >
< taGLTransactionLineInsert >
< BACHNUMB >CMS30< /BACHNUMB >
< JRNENTRY >24440< /JRNENTRY >
< CRDTAMNT >0.00< /CRDTAMNT >
< DEBITAMT >170618104.45< /DEBITAMT >
< ACTNUMST >999-9999-99< /ACTNUMST >
< DSCRIPTN >Contr< /DSCRIPTN >
< DOCDATE >04/23/2014< /DOCDATE >
< /taGLTransactionLineInsert >
< taGLTransactionLineInsert >
< BACHNUMB >CMS30< /BACHNUMB >
< JRNENTRY >24440< /JRNENTRY >
< CRDTAMNT >170618104.45< /CRDTAMNT >
< DEBITAMT >0.00< /DEBITAMT >
< ACTNUMST >999-9999-99< /ACTNUMST >
< DSCRIPTN >Contr< /DSCRIPTN >
< DOCDATE >04/23/2014< /DOCDATE >
< /taGLTransactionLineInsert >
< taGLTransactionLineInsert >
< BACHNUMB >CMS30< /BACHNUMB >
< JRNENTRY >24441< /JRNENTRY >
< CRDTAMNT >0.00< /CRDTAMNT >
< DEBITAMT >4975354.07< /DEBITAMT >
< ACTNUMST >999-9999-99< /ACTNUMST >
< DSCRIPTN >ContrRev< /DSCRIPTN >
< DOCDATE >04/23/2014< /DOCDATE >
< /taGLTransactionLineInsert >
< taGLTransactionLineInsert >
< BACHNUMB >CMS30< /BACHNUMB >
< JRNENTRY >24441< /JRNENTRY >
< CRDTAMNT >4975354.07< /CRDTAMNT >
< DEBITAMT >0.00< /DEBITAMT >
< ACTNUMST >999-9999-99< /ACTNUMST >
< DSCRIPTN >ContrRev< /DSCRIPTN >
< DOCDATE >04/23/2014< /DOCDATE >
< /taGLTransactionLineInsert >
< /taGLTransactionLineInsert_Items >
< taAnalyticsDistribution_Items xsi:nil=\"true\" / >
< taGLTransactionHeaderInsert >
< BACHNUMB >CMS30< /BACHNUMB >
< JRNENTRY >24441< /JRNENTRY >
< REFRENCE >CMS ContrRev 04/23/2014< /REFRENCE >
< TRXDATE >04/23/2014< /TRXDATE >
< TRXTYPE >0< /TRXTYPE >
< USERID >eConnect< /USERID >
< /taGLTransactionHeaderInsert >
< taMdaUpdate_Items xsi:nil=\"true\" / >
< /GLTransactionType >
< /eConnect >


Note that the LineInsert_Items include lines for the prior JE and the current JE.  For each JE that was processed, the number of lines kept growing, as they included all of the lines from all prior JEs.

Aha!  What causes this?  Forgetting to clear the LineInsert_Items array!  I had forgotten to add this line with each header loop:

glLines = new List< taGLTransactionLineInsert_ItemsTaGLTransactionLineInsert >();


And so that one missing line caused the bug, which caused the eConnect error.

As my younger daughter now says (following the lead of her big sister):  "Easy peasy macaroni cheezy!"

Steve Endow is a Dynamics GP Certified Trainer and Dynamics GP Certified IT Professional in Los Angeles.  He is also the owner of Precipio Services, which provides Dynamics GP integrations, customizations, and automation solutions.

You can also find him on Google+ and Twitter






No comments: