Sales Order Cancel. Are you sure?  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Sales Order Cancel. Are you sure?

Postby DannyC » Fri Feb 27, 2015 2:24 pm

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
User avatar
DannyC
Senpai
Senpai
 
Posts: 636
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30

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

Postby Mike.Sheen » Fri Feb 27, 2015 2:34 pm

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 104 times


Mike
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: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 4 guests

cron