Page 1 of 1

Passing Information Between Events on Sales Order

PostPosted: Fri Aug 05, 2016 9:37 am
by SBarnes
Hi Guys

I want to be able to capture information on the creation of an order and then use this information when the order is saved, I am able to capture the details ok by attaching to the created event of the of the sales order, but how can I then recover this information inside a plugin for each unique order without having to resort to UDFs on the sales order as the data does not need to be stored in the database long term as once the order is saved the data is irrelevant .

The only option I have been able to come with thus far would be some sort of static dictionary or list added to the Business Logic to store the information in memory based upon each sales order at the time and then retrieving it back just before the save.

I suppose I am asking are there any other options?

Re: Passing Information Between Events on Sales Order  Topic is solved

PostPosted: Sun Aug 07, 2016 4:34 pm
by Mike.Sheen
SBarnes wrote:how can I then recover this information inside a plugin for each unique order without having to resort to UDFs on the sales order as the data does not need to be stored in the database long term as once the order is saved the data is irrelevant


Our base class for maintenance business logic types have a GenericObjectCollection property. This example plugin uses such a technique.

To store the item:
Code: Select all
JiwaFinancials.Jiwa.JiwaApplication.BusinessLogic.Maintenance maintenanceBL = (JiwaFinancials.Jiwa.JiwaApplication.BusinessLogic.Maintenance)JiwaBusinessLogic;
// Add to generic object collection of object a read and a save variable for the start datetimes
JiwaFinancials.Jiwa.JiwaApplication.BusinessLogic.GenericObjectItem readItem = new JiwaFinancials.Jiwa.JiwaApplication.BusinessLogic.GenericObjectItem();
readItem.RecID = "PerformanceMetric_Read_Start_DateTime";         
maintenanceBL.GenericObjectCollection.Add(readItem);

JiwaFinancials.Jiwa.JiwaApplication.BusinessLogic.GenericObjectItem saveItem = new JiwaFinancials.Jiwa.JiwaApplication.BusinessLogic.GenericObjectItem();
saveItem.RecID = "PerformanceMetric_Save_Start_DateTime";         
maintenanceBL.GenericObjectCollection.Add(saveItem);


To retrieve the item:
Code: Select all
JiwaFinancials.Jiwa.JiwaApplication.BusinessLogic.Maintenance maintenanceBL = (JiwaFinancials.Jiwa.JiwaApplication.BusinessLogic.Maintenance)sender;
JiwaFinancials.Jiwa.JiwaApplication.BusinessLogic.GenericObjectItem readItem = maintenanceBL.GenericObjectCollection["PerformanceMetric_Save_Start_DateTime"];


Does this help ?

Re: Passing Information Between Events on Sales Order

PostPosted: Sun Aug 07, 2016 4:59 pm
by SBarnes
HI Mike

Thanks for the reply, yes this will probably do exactly what I want I can define an object to hold the three lists I want keep and add it to the collection or alternatively put the three lists in under three unique keys.

I just didn't want to fill the database up with irrelevant data that's not needed once the user has decided what to do and order is saved.

Thanks