Company identifier always NULL?

SOLVED

Hello,

My company updated to Sage 50 2020. Since then a program, we wrote, that was working before (Sage 50 2017) stop working.

Diving into the code I found that the CompanyIdentifier is not longer being populated and comes NULL, basically I am using, to troubleshot, the code provided on 

"Software development kit  .NET API quick start guide"
Because the old one (that used to work) is returning NULL when calling CompanyList method:
            if (apiSession != null)
            {
                try
                {
                    // Use the PeachtreeSession class to get list of companies opened
                    // from the default Sage 50 datapath in INI file.
                    companyIdList = apiSession.CompanyList(apiSession.Configuration.ServerName);
                    if (companyIdList != null)
                    {                        
                        foreach (CompanyIdentifier company in companyIdList)
                        {
                            Console.WriteLine(company.CompanyName);
                            Console.WriteLine(company.Path);
                            if (company.CompanyName.Trim().Equals(ConfigurationManager.AppSettings["SageCompany"]))
                            {
                                this.companyId = company;
                            }
                        }
Please help!!

Top Replies

  • 0

    Hey ,

    Dumb question - are you pointing your application to the dummy/test company, or are you using this on a production system? If you're using on a production system (or your own Sage 50 company) then you must use the Sage API key that the API team provided you. If you're using a real DB, can you try it on the sample/provided DB?

    I'll be honest, I've never actually tried to connect to a production/real DB without the key, but I could see it simply returning NULLs/empty data (as opposed to an explicit error/warning message).

  • 0

    Hello, if you subscribe to our Developer Partner Program, we can open a support ticket and look into the issue. Please send your contact details to [email protected] and we will start the application process. Thanks!

  • +1 in reply to fuerstma
    verified answer

    No, I was trying to connect to a test database different from the dummy one. I end up finishing everything on production environment and then everything worked. I guess some configuration on the test environment was preventing me to get the list of companies.