Obtaining Sales Order Type when sales order changed  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

Obtaining Sales Order Type when sales order changed

Postby indikad » Tue Nov 03, 2015 1:32 pm

I need to obtain the Sales Order Type ( among other things ) when the sales order is changed.
for example - in Verion 6513 i have a bit of code on the "Sales Order Changed" event

the code detects "SalesOrderObject.OrderType" when the "Order Type" drop down is changed ( such as Reserve order , Invoice Order etc ...)
The event gives a integer value for the SalesOrderObject.OrderType property - such as 0 for Reserve , 1 for Invoice.

I am trying to replicate this behaviour on Jiwa 7 using the "SalesOrder.PropertyChanged" event however
the "salesOrder.SalesOrderType" property always gives me the value zero ( and the constant - e_SalesOrderNormalSalesOrder)

This makes me think the Property of salesOrder.SalesOrderType in Jiwa 7 is not the same as ""SalesOrderObject.OrderType" in 6513.

* also more importantly - I need to be able to cancel the user action when the user changes the Order Type on the screen and revert back to what it was before ( such as user changes to Invoice Order from Reserve - I need to put it back to Reserve) - this event does not respond to user cancelled exception too..
can someone give me some tips here please ?
indikad
Frequent Contributor
Frequent Contributor
 
Posts: 182
Joined: Thu Jun 18, 2009 1:14 pm
Topics Solved: 2

Re: Obtaining Sales Order Type when sales order changed  Topic is solved

Postby Mike.Sheen » Tue Nov 03, 2015 8:06 pm

indikad wrote:I need to obtain the Sales Order Type ( among other things ) when the sales order is changed.
for example - in Verion 6513 i have a bit of code on the "Sales Order Changed" event

the code detects "SalesOrderObject.OrderType" when the "Order Type" drop down is changed ( such as Reserve order , Invoice Order etc ...)
The event gives a integer value for the SalesOrderObject.OrderType property - such as 0 for Reserve , 1 for Invoice.

I am trying to replicate this behaviour on Jiwa 7 using the "SalesOrder.PropertyChanged" event however
the "salesOrder.SalesOrderType" property always gives me the value zero ( and the constant - e_SalesOrderNormalSalesOrder)

This makes me think the Property of salesOrder.SalesOrderType in Jiwa 7 is not the same as ""SalesOrderObject.OrderType" in 6513.


Try the OrderType property instead of SalesOrderType. SalesOrderType indicates if it is "normal" or back to back - not what you want.

indikad wrote:* also more importantly - I need to be able to cancel the user action when the user changes the Order Type on the screen and revert back to what it was before ( such as user changes to Invoice Order from Reserve - I need to put it back to Reserve) - this event does not respond to user cancelled exception too..
can someone give me some tips here please ?


If you're throwing a clientcancelled exception by responding to the property changed event of the business logic, then it's already too late - it's already been set. You will need to store away the OrderType value on ReadEnd and CreateEnd, and then when you handle the property changed event, set it back to your stored value. If you're doing such things with many properties, one trick is on readend and createend to serialsise the salesorder into an XML.SalesOrder private field, then you have access to all properties as they were before any edit, and can set them back (bonus feature here is you can also do an XML diff on save to see all the properties changed on edit! - I've used that previously to write an audit away of who changed what from and to and when).
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: Obtaining Sales Order Type when sales order changed

Postby indikad » Thu Nov 05, 2015 12:35 pm

Thanks for this tip Mike.
indikad
Frequent Contributor
Frequent Contributor
 
Posts: 182
Joined: Thu Jun 18, 2009 1:14 pm
Topics Solved: 2


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 0 guests