7.2.1 CreateBusinessLogic NullReferenceException  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

7.2.1 CreateBusinessLogic NullReferenceException

Postby neil.interactit » Tue Sep 22, 2020 12:32 pm

Hey guys,

I have an external application, implemented in an external EXE, referencing JiwaApplication,JiwaODBC,JiwaSales.

I am upgrading it from 7.175 to 7.2.1 and have run into an issue.

I upgraded:
Code: Select all
   var salesOrder = Manager.Instance.BusinessLogicFactory.CreateBusinessLogic<SalesOrder>(null);

To:
Code: Select all
   var manager = new JiwaFinancials.Jiwa.JiwaApplication.Manager();
   var salesOrder = manager.BusinessLogicFactory.CreateBusinessLogic<SalesOrder>(null);

And the CreateBusinessLogic method call now generates a Object reference not set to an instance of an object error.

Once I debugged into the compiled assemblies, the Object reference not set to an instance of an object error occurs on line 57:
Code: Select all
businessLogicType.Setup();

Note that all the other Manager.Instance upgraded code (manager.Logon, manager.LogOff, etc) is all working fine.

I have tried adding an expilict reference to JiwaSalesUI, and also (per viewtopic.php?f=26&t=795) have tried:
Code: Select all
   var manager = new JiwaFinancials.Jiwa.JiwaApplication.Manager();
   var form = manager.FormFactory.CreateForm<JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.SalesOrderEntryForm>(); // create a form to work-around DEV-6053
   var salesOrder = manager.BusinessLogicFactory.CreateBusinessLogic<SalesOrder>(form);
   salesOrder.Client = null;

Neither has helped.

Can you advise how to remedy this?

Cheers,
Neil.
neil.interactit
Kohai
Kohai
 
Posts: 223
Joined: Wed Dec 03, 2014 2:36 pm
Topics Solved: 6

Re: 7.2.1 CreateBusinessLogic NullReferenceException  Topic is solved

Postby Scott.Pearce » Tue Sep 22, 2020 1:31 pm

You need to do a .logon() after creating the manager, but before using the factory.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: 7.2.1 CreateBusinessLogic NullReferenceException

Postby neil.interactit » Tue Sep 22, 2020 3:54 pm

Nailed it! Many thanks Scott.
neil.interactit
Kohai
Kohai
 
Posts: 223
Joined: Wed Dec 03, 2014 2:36 pm
Topics Solved: 6


Return to Technical and or Programming

Who is online

Users browsing this forum: Google [Bot] and 5 guests

cron