We’ve developed some resources to help you work effectively from home during COVID-19 Click to learn more

Win Script and Event system: Aborting a Save sequence

8.5 R07 should be out soon.
You will then be able to abort a Save Model sequence on the Current system.

1. From an internal script's On*BeforeSave message like this example:

Sub OnCurrentContactBeforeSave
  result = somessagebox( "Continue saving contact?", CurrentContact.Name, vbYesNo )
  If result = 3 Then
      Call Err.Raise(vbObjectError + 10, "", "")
      somessagebox "Should never get here"
  End If 
End Sub

2. From an EventServer subscription like this c# example

public int CurrentContactBeforeSave()
    if ( CanSaveContact() );
        return 0;
        return 999; // Some dummy error code > 0



Probably too little too late but still...
Many of you are using VB Scripting to Validate - for good or bad.
(Does not matter what we say, you will try and find a way). 
Often this validation is very processor heavy. Then things like keyboard input in Name fields start to crawl or worse.
Now you can use the *BeforeSave events not only for setting fields but also as a singular validation point.
Invoke message boxes and/or use the ValidationMessage property to disable the save button and we will abort the save sequence giving the user a chance to put things right and click Save again..

This works well for all main entities that are current.

Post Comment