Skip to main content
Kofax

How can a field be set to the Windows or Capture user name of the user running KTM Validation?

16748

QAID # 16748 Published

Question / Problem:

How can a field be set to the Windows or Capture user name of the user running KTM Validation?

Answer / Solution:

The example script below assumes that there is project-level field named "ValidationUser" which is set to be always valid. The sample below uses the Windows user name stored in the AC_BATCH_WINDOWSUSERNAME XValue. To use the Capture user name, use AC_BATCH_USERNAME. To use the Capture user ID, use AC_BATCH_USERID.

Private Sub Batch_Close(ByVal pXRootFolder As CASCADELib.CscXFolder,
                             ByVal CloseMode As CASCADELib.CscBatchCloseMode)
If Project.ScriptExecutionMode=CscScriptExecutionMode.CscScriptModeValidation Then
    Dim i As Integer
    Dim XDoc As CscXDocument
    For i=0 To pXRootFolder.DocInfos.Count - 1
        Set XDoc=pXRootFolder.DocInfos.ItemByIndex(i).XDocument
        XDoc.Fields.ItemByName("ValidationUser").Text = _
            pXRootFolder.XValues.ItemByName("AC_BATCH_WINDOWSUSERNAME").Value
        Next
    End If
End Sub 

Applies to:

Product  Version  Category 
AXPRO 4.5 Validation
AXPRO 5.0 Validation
AXPRO 5.5 Validation