Page 1 of 1

Sales Order Cancel. Are you sure?

PostPosted: Fri Feb 27, 2015 2:24 pm
by DannyC
Hi,

Is it possible to have a Are you Sure? prompt when the user hits the cancel button on the sales order ribbon button?

Cheers

Danny

Re: Sales Order Cancel. Are you sure?  Topic is solved

PostPosted: Fri Feb 27, 2015 2:34 pm
by Mike.Sheen
DannyC wrote:Is it possible to have a Are you Sure? prompt when the user hits the cancel button on the sales order ribbon button?


Yes - it's pretty simple - add a handler for the tool click in the SetupBeforeHandlers (that way your handler gets the click BEFORE the sales order form does), then in that handler just ask the question and throw a new clientcancelled exception to cause the cancellation of the click.


Code: Select all
Public Sub SetupBeforeHandlers(ByVal JiwaForm As JiwaApplication.IJiwaForm, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaFormPlugin.SetupBeforeHandlers
    Dim salesOrderForm As JiwaSalesUI.SalesOrder.SalesOrderEntryForm = DirectCast(JiwaForm, JiwaSalesUI.SalesOrder.SalesOrderEntryForm)
    AddHandler salesOrderForm.UltraToolbarsManager1.ToolClick, AddressOf UltraToolbarsManager1_ToolClick
End Sub

Private Sub UltraToolbarsManager1_ToolClick(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinToolbars.ToolClickEventArgs)
   Dim salesOrderForm As JiwaSalesUI.SalesOrder.SalesOrderEntryForm = DirectCast(sender, Infragistics.Win.UltraWinToolbars.UltraToolbarsManager).DockWithinContainer
   
   Select Case e.Tool.Key
      Case "ID_RecordCancel"
         If MsgBox("Are you sure?", vbYesNo + vbQuestion, "Confirm Cancel Changes") = vbNo Then
            Throw New JiwaApplication.Exceptions.ClientCancelledException
         End If
   End Select
End Sub


A working sample is attached.
Plugin Sales Order Confirm Cancel Changes.xml
Sample Plugin
(33.44 KiB) Downloaded 107 times


Mike