cancel
Showing results for 
Search instead for 
Did you mean: 
Patrick_Sweeney
Star Contributor
Star Contributor

Continuing in our efforts to highlight Unity Script Hooks, in this article we’re going to focus on a few new script hooks that function as entry points into the scanning and import processes available to the Unity Client. These entry points can be used for input validation, pre and post document processing, and manipulating the Keyword Panel seen during the scanning process.

The entry points are Scan Queue – Pre-Scan, Scan Queue – Process Input File List, Scan Queue – Post-Scan, and Scan Queue – Post-Sweep.

Scan Queue – Pre-Scan

The Scan Queue – Pre-Scan script executes prior to the batch actually being scanned. As such it can be used as part of a validation check where script logic can check specific requirements (e.g., Keyword Values) and if the requirements are not met the script hook can cancel the scan process. It can also be used to pre-process the scan batch, changing index values prior to Scan execution. The script is configured via the IScanQueuePreScanEventScript  script interface.

Upon execution completion OnBase checks the value of args.ScriptResult. If the ScriptResult is set to Cancel then the scan process is canceled and the script is not run.  No messages are displayed to the user and any messages explaining this activity must be generated by the script, if needed.

The script’s event arguments give the developer access to the current IndexKeywordPanel, ScanQueue, KeywordPanelUpdates and ScanSettingUpdates. 

The ScanQueue object can be accessed to retrieve data about the Scan Queue, such as ID, Default Document Type, etc. or manipulate the Scan Queue and its batches.

The current IndexKeywordPanel object allows the script to access and view a snapshot of the KeywordPanel at the time just before the scan executes.

To update the KeywordPanel values the script will have to access the KeywordPanelUpdates off of args.Results. The KeywordPanelUpdates object allows the manipulation of the KeywordPanel not just manipulation of the values before they are added to documents being indexed. Even if the script fails and the scan process is halted the changes made to the KeywordPanelUpdates should be reflected in the user interface Keyword Panel.

The IScanQueuePreScanEventScript is also capable of modifying the Scan Format and Scan Mode via the ScanSettingUpdates object.

Scan Queue – Process Input File List

Like the previous Unity Script Hook, the Scan Queue – Process Input File List hook executes in exactly the same manner, but for a Sweep procedure. This allows the user to pre-process and validate sweep batches as they’re occurring. It can be leveraged using the script interface: IScanQueueProcessInputFileList.

Since this script hook largely works like the previous the same information is going to be available as well from the event arguments.

Scan Queue – Post-Scan

The Scan Queue – Post-Scan script is executed after a Scan Queue has been successfully executed in the client and the scanned documents have been stored into OnBase. Configuration can be acompished using the IScanQueuePostScanEventScript script interface.

Depending on the index options selected before running the Scan Queue configured with the script either the OnPendingIndexExecute or the OnFullIndexExecute method in the script will be executed. OnPendingIndexExecute will be entered if the “No-Index” or “Pre-Index” options were selected when executing the Scan Queue and your queue contains at least one unindexed document. It will give the user access to the Scan Queue and the unindexed document. Otherwise OnFullIndexExecute will be entered and will give the user access to the Scan Queue and the indexed document that resulted from executing the Scan Queue.

Both the document objects function largely as standard OnBase Document objects and the user can access and manipulate document properties and keyword data. As expected the Document from the OnFullIndexExecute method should have been fully indexed by the scan process and as such should have populated values for the script to access. The UnindexedDocument on the other hand has no index information on it, and so information like Keyword values are unpopulated when accessing the UnindexedDocument. Furthermore the UnindexedDocument gives the script access to the ScanBatch and allows the script to add additional documents to the batch to be worked with.

The ScanQueue object is also accessible for both script hooks (and both entry points). It is also functionally identical to the ScanQueue object already discussed in the PreScan and ProcessInputFileList script hooks above.

Scan Queue – Post-Sweep

The Scan Queue – Post-Sweep script is functionally similar to the Post-Scan script hook and has the exact same two entry points: OnPendingIndexExecute and OnFullIndexExecute. The only real difference is that Post-Sweep script hooks are executed when using the Sweep button of OnBase during scanning as opposed to Scan like the previous script. This script can be created using the IScanQueuePostSweepEventScript  script interface.

In Conclusion

Unity Scripts can be very versatile and allow for the pre and post-processing for scanning and sweeping document into OnBase. This processing can range from validation processing to data manipulation.

With a little imagination these script hooks can be used to automatically route documents based on specified indexes, to deny applications for not meeting logical criteria, to add related documents to the same Document Type when appropriate. The entry points before and after the Scan/Sweep events provides a large array of possibilities for import processing.

Be sure and leave us a comment below if you have any questions/concerns or just want to talk about the featured Script Hooks.