Tuesday, November 6, 2012

When developing eConnect integrations, don't forget the details...

I am testing an eConnect SOP Invoice integration that I just developed.  The invoices are importing fine, and everything looks good...except...the invoice distributions are duplicated.  Instead of 3 distribution lines, there are 6 lines.

Hmmm, that isn't good.  I'm sending in the three distributions, and they look good in GP, but somehow they are being duplicated.

I triple check my code to confirm I'm not doing anything silly, and the code looks good.  I then check the XML that is being sent to eConnect, and it looks good as well--only 3 distributions are being sent.

Puzzled, I then do a SQL trace on the eConnect inserts to see what it is doing.  The trace confirms that taSopDistribution is only being called 3 times, not 6 times.

So if only 3 distributions are being sent to eConnect and the stored procedure is only being called 3 times, how do I have 6 distribution lines in GP?

Although I have encountered several eConnect bugs over the years, I found it difficult to believe that this could be an eConnect bug.  Hundreds of people would have discovered this issue by now, so I have to assume it isn't a bug.

I then decide to randomly query the distribution records in SQL (SOP10102) to see what they look like.  And that is when it dawns on me.

Notice that the first three records have a DistRef value.  But the last 3 records don't.

The first three records are ones that I'm sending in to eConnect.  So what are the second three?

They look like the default distributions.  The distributions that would normally be created if you didn't send any distribution data to eConnect as part of the SOP invoice.  Which happens when you send a value of taSopHdrIvcInsert.CREATEDIST = 1.  Or, if you don't send any value for CREATEDIST.  Or if you forgot to send a value for CREATEDIST.


As soon as I saw the distribution records in  SOP10102, I realized what I had missed.  One little tiny detail that is kind of important.  Well, it's important if you want your distributions to be correct...

Don't forget the details!

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.


No comments: