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

One of the new scripts added for OnBase 16 is the Scan Queue Custom Processing script. This script runs on scan queues with a custom processing step configured to run a Unity Script, and allows you to perform processing and reporting on the documents in a scan batch. Using this script, you’ll be able to make your scanning and indexing processes more powerful than ever before.

 

There are four methods that need to be implemented in the IScanQueueCustomProcessingScript interface. Let’s take a closer look at what each one does.

 

OnBatchBegin

 

This method is called before any documents in the scan batch are processed by the script. It can be used to perform any required setup before the documents are processed. The ScanQueueCustomProcessingBatchEventArgs class exposes one property – the scan queue which the script is running against.

 

OnItemExecute

 

This method is invoked on each individual document being processed by the script, and allows you to read from or modify the documents being processed. You may notice that there are two OnItemExecute methods, one with a ScanQueueCustomProcessingEventArgs argument and one with a ScanQueueCustomProcessingUnindexedEventArgs argument. Depending on the configuration of your scanning and indexing process, the documents being processed by the Custom Processing script may not be fully indexed yet. If a document which is not fully indexed is encountered by the script, the OnItemExecute overload which takes a ScanQueueCustomProcessingUnindexedEventArgs is called. If the document has been fully indexed, the ScanQueueCustomProcessingEventArgs overload is called. In order to ensure that your script correctly processes all documents, we recommend implementing both OnItemExecute overloads.

 

ScanQueueCustomProcessingEventArgs and ScanQueueCustomProcessingUnindexedEventArgs are very similar. They both expose a ScanQueue and ScriptResult property. The only difference is ScanQueueCustomProcessingEventArgs exposes a Document property, whereas ScanQueueCustomProcessingUnindexedEventArgs exposes an UnindexedDocument property.

 

There are two values for the ScriptResult – Continue and Cancel. Continue is used to indicate that the script has executed successfully and that the batch should be transitioned to its next status. Setting the ScriptResult to Cancel will prevent the batch from transitioning. If not explicitly set, the ScriptResult will default to Continue.

 

OnBatchEnd

 

This method is called after all of the documents have been processed. Any final processing or teardown can be performed here. If you created any disposable or other unmanaged resources in your script, this method is a good place to clean them up in order to prevent memory leaks. The ScanQueueCustomProcessingBatchEventArgs is the same as in OnBatchBegin, and exposes just the scan queue.

 

In Conclusion

 

We hope that you’ll be able to use the Scan Queue Custom Processing script to extend and customize your scanning and indexing processes in exciting new ways. If you have any questions, comments, or just want to share something cool you did with this script, feel free to leave a comment below. Next Monday, we'll be checking out another new script hook being introduced in OnBase 16: for the Unity Scheduler.