Microsoft Great Plains Integration Manager - advanced techniques
By Andrew Karasev
Posted Tuesday, October 5, 2004
Great Plains Integration Manager scripting and translation - overview for programmer, software developer, database administrator, IT specialist
Microsoft Business Solutions main middle market ERP application - Microsoft Great Plains has multiple integration options: MS SQL Scripting (stored procedures and views), ADO.Net programming, Microsoft SQL Server DTS packages. You certainly can deploy such SDK tools as eConnect. However here we would like to show you how to program the simplest user friendly tool: Microsoft Great Plains Integration Manager.
We assume that you are familiar with Microsoft scripting technologies: Visual Basic for Application (VBA). You should be aware, however, about poor performance of Integration Manager. We recommend it for low volume of complex transactions. It is good tool, if you are importing about 100 transactions per day from text file (when you need to come through empty lines or something not matching the template to filter integration lines). If you have thousand transactions and performance is critical - switch to SQL Stored procs or Dexterity custom process server.
1. VBA Scripting Launch Great Plains Integration Manager, open your integration, right click->Properties, switch tab to scripts, open Before Document script. Now place this code in it:
If Left(SourceFields(\"F4\"), 4)=\"THRU\" Then SetVariable \"DocDate\", Right(SourceFields(\"F4\"), 8) End If If IsNull(SourceFields(\"F1\")) Or IsNull(SourceFields(\"F7\")) Then CancelDocument End If
It should mean that you can create DocDate variable and assign it the value from your query field. The second statement cancels document integration if certain condition met (when line is empty or is not actually integration line - something like comment record, etc.)
Now open Before Document Commit script and place this code there:
Dim MyTime, MyHour MyTime = Now MyHour = Hour(MyTime) If Not IsNull(GetVariable(\"DocDate\")) then SetVariable \"DocNumber\", GetVariable(\"DocNumber\")+1 DestinationFields(\"Document Number\")=\"THRU\"+GetVariable(\"DocDate\") &\"A\" & GetVariable(\"DocNumber\") DestinationFields(\"Posting Date\")=GetVariable(\"DocDate\") DestinationFields(\"Description\")=\"Client Check \"+ SourceFields(\"F1\") If Not IsNull(SourceFields(\"F8\")) Then DestinationFields(\"Check.Check Number\")=SourceFields(\"F8\") Else SetVariable \"DocNumber\", GetVariable(\"DocNumber\")+1 DestinationFields(\"Check.Check Number\")=GetVariable(\"DocDate\")& MyHour&GetVariable(\"DocNumber\") End If DestinationFields(\"Check.Date\")=GetVariable(\"DocDate\") If Month(DestinationFields(\"Check.Date\")+1)= Month(DestinationFields(\"Check.Date\")) Then DestinationFields(\"Check.Date\")=DestinationFields(\"Check.Date\")+1 End If End If
Here you do two things. First you construct check number, using Date and time plus Document number. And the second is even more interesting - you alter check date.
In After Integration script place this code:
ClearVariables
It is good idea to nullify your variables.
2. Translation. Imagine that your are something like collection agency and you need to translate your vendors (from whom you purchase AR) into real vendors (banks). In AP integration open Destination Mapping, select Vendor ID, in the Rule Properties, click on the button next to Translation field, answer No, click on Translation tab and paste from Excel your translation list, something like this:
JOHNB
BANKOFAMERICA
PETERP
BANKOFAMERICA
MARTHAM
CITIBANK
Now your vendors from integration file will be replaced with real vendors from Great Plains.
Happy integrating! if you want us to do the job - give us a call 1-866-528-0577! help@albaspectrum.com
About the Author
Andrew Karasev is Chief Technology Officer in Alba Spectrum Technologies USA nationwide Great Plains, Microsoft CRM customization company, based in Chicago, California, Colorado, Arizona, New York, Texas, Florida, Georgia, Canada, UK, Australia and having locations in multiple states and internationally (www.albaspectrum.com), he is Dexterity, SQL, C#.Net, Crystal Reports and Microsoft CRM SDK developer.