Question / Problem:
Validation Method - Verify Current Instance of KTM Validation
Answer / Solution:
Below is a scripted Validation method that displays a message box if running in Validation Step 2. During Server processing, or for any other Validation steps, it is not displayed. This can be used if you want to process a special check only for a defined Validation step.
Note for the function to work the following is required:
- Create a Single Field Script Validation Method named "CheckValidationStep"
- Assign the Validation Method to a Validation Rule.
- Ensure the Validation Rule is assigned to a field that is displayed in KTM Validation 2.
Private Sub CheckValidationStep_Validate(ByVal pValItem As CASCADELib.ICscXDocValidationItem, _ ByRef ErrDescription As String, _ ByRef ValidField As Boolean) If (Project.ScriptExecutionMode = CscScriptModeValidationDesign Or _ Project.ScriptExecutionMode = CscScriptModeValidation) And _ Project.ScriptExecutionInstance = 2 Then ' this part is only executed during validation step 2 MsgBox ("This is validation step 2", vbOkOnly) End If End Sub