Page 1 of 1
Sales Order Line Changed in the Sales Order Screen

Posted:
Thu Jul 06, 2017 3:17 pm
by SBarnes
Is there an easy way to detect that a line in a sales order has been changed by the User Interface and not plugin code?
I know the event on the sales order of the form has SalesOrderLineChanged but is there a way of only detecting the event from the user and not possibly being caused by plugin code as well?
Re: Sales Order Line Changed in the Sales Order Screen

Posted:
Sun Jul 16, 2017 12:43 pm
by Mike.Sheen
Only way to do that is add a handler for the grid change event and set a flag in a try finally block, and in the finally clear the flag (or better yet restore the flag to the value before).
Then in your code elsewhere you'd need to check the value of that flag to determine if the change originated from the user.
Re: Sales Order Line Changed in the Sales Order Screen 

Posted:
Sun Jul 16, 2017 7:56 pm
by SBarnes
Hi Mike,
I followed a similar logic and used a Boolean that set at the start of the processing code to bail out of the event firing code and only have it fire if the Boolean is set to false.