Page 1 of 1

Generic Object Collection on Sales order form

PostPosted: Wed May 26, 2021 12:25 pm
by SBarnes
I have just tried accessing the sales order form generic object collection in the set up before handler to discover it is null, this is not the case in the set up handler, is this a bug?

Re: Generic Object Collection on Sales order form

PostPosted: Wed May 26, 2021 12:40 pm
by Mike.Sheen
SBarnes wrote:I have just tried accessing the sales order form generic object collection in the set up before handler to discover it is null, this is not the case in the set up handler, is this a bug?


The BusinessLogic.Maintenance base class sets the GenericObjectCollection inside the Setup method - so Setup before it will be null.

We cannot do it before Setup because we don't have a Manager at that point to create the JiwaCollection with.

Code: Select all
Public Overridable Sub Setup() Implements IJiwaBusinessLogic.Setup
   _PropertiesChanged = New Collection(Of String)
   _SortOrders = New List(Of IJiwaNavigable.SortKey)
   _GenericObjectCollection = Manager.CollectionFactory.CreateCollection(Of GenericObjectCollection, GenericObjectItem)
   _AbstractPermissionCollection = Manager.CollectionFactory.CreateCollection(Of AbstractPermissionCollection, AbstractPermission)
   _BaseFindSQLQuery = String.Format("SELECT TOP 1 {0} FROM {1}", RecIDFieldName, TableName)
End Sub


So no, not a bug as such. But I can see it being a problem if you want to use the GenericObjectCollection in a plugin in the SetupBefore method.

Re: Generic Object Collection on Sales order form  Topic is solved

PostPosted: Wed May 26, 2021 12:44 pm
by SBarnes
I got around the problem by just moving the adding something to the collection to the set up handler and just used the before setup handler to attach the necessary handlers to get in front of the standard code.