Thursday, May 5, 2011

IM: Integrating Timesheet Line Items not associated to a project

Just recently, I was following a thread on the Microsoft Dynamics GP Partner Forum where the partner was attempting to integrate timesheets using the eConnect Adapter for Integration Manager, but kept getting the error:

DOC 1 ERROR: eConnect The 'NONE' start tag on line 1 does not match the end tag of 'PAPROJNUMBER'. Line 1, position 2316.

When entering timesheets in the Timesheet Entry window, you can enter a line item that isn’t for a specific project by pressing TAB to default the project number to "". This instructs Microsoft Dynamics GP Project Accounting that there will be no project associated to the timesheet line.

As logic would have you believe, if you are integrating a timesheet line that is not associated to a project, it would be enough to pass the same "" string value to the timesheet line and things should be fine, right? Wrong! Passing in the "" tag caused the timesheet integration to fail with the error above.

Now to the error...

The error clearly indicates that there is a problem with an XML tag - presumably when Integration Manager serializes the source data into its XML representation.

Since IM has to marshall the source data (also known as serialization), the "" string value is being interpreted and converted to an XML tag within the serialized document. This will cause the XML document to be inaccurate. This is a representation of what I assume is happening after the conversion:


<taPATimeSheetLineInsert>
<PATSTYP>1</PATSTYP>
.
.
<PAPROJNUMBER><NONE></PAPROJNUMBER>
.
.
</taPATimeSheetLineInsert>

As shown above, the "" string value is interpreted as a new tag rather than the actual string value causing an open tag in the XML value, hence causing the integration fail. The partner confirmed that by calling eConnect's taPATimeSheetLineInsert stored procedure directly and passing in the "" string value in the project number field directly, that eConnect would process the document without any issues.

This is actually a good thing!

Furthermore, Microsoft has identified this to be an issue with the eConnect Adapter for Integration Manager and has scheduled this problem to be resolved in Service Pack 3 - no, it did not make the cut for 2010 R2/SP2.

However, the workaround is as follows:

1. Pass/Map a value of NONE to the Project Number field for the timesheet line in Integration Manager. If your source data includes the actual tags (< and >) you can use a simple field script to remove them.

2. Edit the eConnect taPATimeSheetLineInsertPRE stored procedure to include the following T-SQL code:

-- Created by Mariano Gomez, MVP
-- This code is licensed under the Creative Commons 
-- Attribution-NonCommercial-ShareAlike 2.5 Generic license.
ALTER PROCEDURE dbo.taPATimeSheetLineInsertPRE
.
.
AS
IF UPPER(@I_vPAPROJNUMBER) = 'NONE'
  BEGIN
    SELECT @I_vPAPROJNUMBER = '<NONE>';
  END


Since the PRE stored procedure executes before the rest of the taPATimeSheetLineInsert code, the proper value will be passed in to the timesheet line, hence preventing the error.

Until next post!

MG.-
Mariano Gomez, MVP
IntellPartners, LLC
http://www.IntellPartners.com/

No comments: