How to reliably save the user who processed the Verification Task in the Document's Field?

Question

How to reliably save the user who processed the Verification Task in the Document's Field?

Answer

The following settings are available only for the Desktop Verification Station.

  1. Open the project in the Project Setup Station.
  2. Add the text Field called usernameField in the Document Definition.
  3. Go to Project > Project Properties > Stage Tools tab.
  4. Edit the Verification stage:
  5. Add an event handler On Task Close:
  6. Add the following script:

The script code:

using System;
try
{
    foreach( IDocumentItem document in TaskWindow.DocumentsWindow.Items)
    {
        TaskWindow.OpenDocument( document.Document );
        var section = document.Document.Sections[ 0 ];
        var name = "usernameField";
        if( section.HasField( name ) )
        {
            section.Field( name ).Text = FCTools.CurrentUserSession.UserName;
        }
    }
}
catch( Exception ex )
{
    FCTools.ShowMessage( "Error: " + ex.Message );
    CanClose.Value = false;
}

The script will save the user who processed the Verification Task in the usernameField Field of the Document Definition.

Have more questions? Submit a request

Comments

1 comment

  • Avatar

    Ivan Diaz

    Just sharing my experience with this.

    On Task Close will change the field the moment you click Task Close, as if the user is typing the field. However, ABBYY will prompt with a "save" pop-up to apply the changes.

    If you want an auto-populated username without ABBYY asking you to save, I used "On Activate Document" instead of "On Task Close". This will add-in the username during Get Task / Opening the document.

    0

Please sign in to leave a comment.