Skip to main content

Notifications

Microsoft Dynamics GP (Archived)
Suggested answer

Help retrieving GL Transactions.

Posted on by 35

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

  • Help retrieving GL Transactions.
  • Suggested answer
    Steve Kubis Profile Picture
    Steve Kubis on at
    RE: Help retrieving GL Transactions.

    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.

  • talty09 Profile Picture
    talty09 35 on at
    RE: Help retrieving GL Transactions.

    No help at all?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans