1 Reply Latest reply on Feb 27, 2009 2:13 AM by Orlando

    Confirming Delete

    ohhhmy

      Title

      Confirming Delete

      Post

      Hi Everyone,

       

      Right now I have a delete button which will delete the current contact I am viewing. How do I make it so that when I click the delete button it asks me if i'm sure I want to delete. This would help reduce any accidental deletion of items.

       

      Thanks.

        • 1. Re: Confirming Delete
          Orlando
            

          Hi ohhhmy

           

          Do you currently have a script, or button, that simply uses the script step Delete Record?

           

          If you want a message to pop-up then you need to write a script that will show a custom dialog and then act upon the users decision using the Get ( LastMessageChoice ) function.

           

          The script will look something like this:

            

          #  
          Show Custom Dialog [ "Are you sure you want to delete this record" Button 1 "No" ; Button 2 "Yes" ]
          If [ Get ( LastMessageChoice ) = 1 // Cancel ]
          Halt Script
          End If
          Delete Record / Request 
          #

           

          Make the Default option a negative option so if the user hits return without reading the record will not be deleted. 

           

          You could also add an option so if the user is holding down the Command key, or any other modifier key, they do not see the dialog, so place lines 1-5 inside the an if statement that checks the modifier key

           

          #  
          If [ Get ( ActiveModifierKey ) = 16 // Command on Mac ]
          Show Custom Dialog [ "Are you sure you want to delete this record" Button 1 "No" ; Button 2 "Yes" ]
          If [ Get ( LastMessageChoice ) = 1 // Cancel ]
          Halt Script
          End If
          End If
          Delete Record / Request 

           

           

          Let me know if either of these help