really hoping someone can help me out here. I am working with Microsoft Dynamics Great Plains (GP) web services. Basically we need to directly integrate with GP through our app. I have been doing some digging around in an attempt to map my internal business objects to the dynamics GP business objects for saving. I am having some major confusion on how the webservices work. Go figure, the microsoft documentation is garbage once again and only provides a very very basic overview of the objects with absolutely no examples (or very lackluster examples that lack any depth of explanation). I have gotten the proper permissions setup to execute the following methods:
GetGLPostedTransactionByKey
GetGLTransactionByKey
GetGLTransactionList
I also have access to the database I need to view the database data. Only problem is this doesnt exactly give me a full view on the mapping from the GLTransaction/GLPostedTransaction objects to my internal objects. So I am targeting some same records by using the DB to find journalIds and dates to enter as criteria. I executed the GetGLTransactionList and was able to see a set of data that I want to test. I also cross referenced the database to identify the records. The biggest problem, however, is that and array of the GLTransactionSummary object is returned and the GLTransactionSummary object is a smaller/lighter/summary version of the entire object. I am trying to map the GLTransaction or GLPostedTransaction object which contain many more fields.
I setup some tests in my application and based off of some of the summary objects returned by the GetGLTransactionList I took some test data. I grabbed the Key.JournalId and Key.Date properties. Our upload process allows multiple gl transactions to have the same journalId (maybe an issue?). My next step was to attempt to use the GLTransactionKey information to query GP and pull back an object. After setting up 2 methods for GetGLTransactionByKey and GetGLPostedTransactionByKey and using the test key data...both methods return the "Business object not found" exception.
What am I doing wrong? Could it be because of the way these are being entered? As I said, currently they are being entered where multiple records can have the same journalId. I initially thought this to be an issue because the GLPostedTransaction and GLTransaction objects are not an array, collection, list, or enumerable. Past that I have no idea where these could be hiding or how to access them. I could really use any help at all.
*This post is locked for comments
From reading through your description, it sounds like you're trying to read GL transactions from Dynamics GP, and then use that data is some other system. You're on the right track. Rather than trash the example code, look at it carefully. It's showing you what you need to do.
You're right to begin with the GetGLTransactionList() method. From your description, you are able supply appropriate criteria to this method so that it will retrieve the summary GL transaction objects for the transactions you want to work with. So far, so good.
So far, your code will look very much like the example for the GetGLTransactionList() method. The next step is to work with the summary object collection. This is the snippet from the example:
foreach (GLTransactionSummary a in transactionSummaries)
{
summaryList.AppendLine("Journal Id: " + a.Key.JournalId + " Reference: " +
a.Reference);
}
You don't say what language you're using, so I'll assume C#. The foreach statement will loop through all of the summary objects that were returned. If you look at the documentation for the summary object, you'll see that its first property is "Key" of type GLTransactionKey. Hey! That's the exact object that I need to pass to the GetGLTransactionByKey() method to retrieve the full transaction object. Simply use the key value from the summary object, and you should be able to retrieve the information you need. Your code will look something like this:
GLTransactionKey glKey;
GLTransaction glTran;
foreach (GLTransactionSummary a in transactionSummaries)
{
glKey = a.Key;
glTran = wsDynamicsGP.GetGLTransactionByKey(glKey, context);
// Now use the full glTran object to add data to your other system
}
Now you'll have the full GLTransaction object, and it's up to you to decide what you want to do with the information to get it added to your other system.
I hope this helps. The next time you have an issue and post to this forum, I think you'll have better luck getting a response if you post more relevant details of the problem you're trying to solve, and perhaps a little less Microsoft bashing.
No help at all?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,902 Super User 2024 Season 2
Martin Dráb 229,316 Most Valuable Professional
nmaenpaa 101,156