cancel
Showing results for 
Search instead for 
Did you mean: 
Tyler_Sorber
Star Collaborator
Star Collaborator

One of the highly anticipated enhancements of OnBase 14 is the addition of Unity Script Hooks.  For those who do not know, Unity Script Hooks allow different entry points to the Unity API through the Unity Client interface.

For the Unity API blog, we have categorized the different Unity Script Hooks into different sections based on similar functionality, allowing multiple script hooks to be covered at once.  In this particular section, we'll be covering script hooks that tie directly into events triggered by some generic, document interactions.

Document - Cross-Reference

The Document – Cross-Reference script hook is mostly straightforward, being run before a cross-reference search is performed. This allows you to perform changes on your current document before a related, referenced document is retrieved. Configuration can be done via the IDocumentCrossReferenceEventScript interface. This functionality is available within the OnBase Unity Client as well as the Microsoft Office Integration.

From the DocumentCrossReferenceEventArgs in the script you have access to the current document and a ScriptResult. This allows you to use all of the existing functionality through the Unity API to do what you want with the given document object however you please and potentially cancel the operation if you don’t like it. I’d like to mention again though that this object is the document that the Cross-Reference was executed against, rather than a referenced document.

Document - Add/Modify Keywords

The Document – Add/Modify Keywords script hook is executed when keywords on a document are edited and saved within the Add/Modify Keyword Panel.  The script is initialized from the save button and is will take place prior to data being committed to the database.  This script hook can be executed from the OnBase Unity Client as well as the Microsoft Office Integration.

Three of the major properties from the event arguments for this script are OriginalKeywordPanel, KeywordPanel, and DocumentReindexPreArchiveEventResults.  DocumentReindexPreArchiveEventResults is really only used for the KeywordUpdates object that it contains. A ScriptResult is also available for canceling out of the operation if you decide to do that.

The OriginalKeywordPanel property allows the user to access a document’s keywords before they were modified, whereas KeywordPanel retrieves the current, potentially modified values. These will give you contextual information for actually updating the keywords in the KeywordUpdates object. KeywordUpdates also has the ability to change other properties in the KeywordPanel as well such as the DocumentType and the DocumentDate.

Document - Re-Index (Pre-Archive)

The Document – Re-Index (Pre-Archive) script hook is executed when the re-index button is pressed within a client’s re-index keyword panel prior to the keywords being saved to the database.  Much like the previous script, this allows keyword validation and modification to occur before actually committing changes to the database.  This script can also be run from the OnBase Unity Client, Microsoft Office Integration, and OnBase MRM Client.

From the DocumentReindexPreArchiveEventArgs, similar functionality as the script above is available as far as the re-index keyword panel is concerned. You can change anything from the Keyword values to the DocumentDate prior to your Document’s archival. The ScriptResult property is also going to be available here for canceling any potential operations.

Document - Re-Index (Post-Archive)

The Document – Re-Index (Post-Archive) script hook is also executed when the re-index button is pressed within a client’s re-index panel, however this script is executed directly after the keywords are committed to the database.  This script hook can be executed from the OnBase Unity Client, Microsoft Office Integration, and OnBase MRM Client.

Since this is post-archival, the DocumentReindexPostArchiveEventArgs off of this script will only contain two properties including the Document object and the OriginalKeywordPanel. The OriginalKeywordPanel can be obtained to access the keywords before they are modified by the re-index process in case you want to revise any changes through the Unity API after the fact.

In Conclusion

Unity Script Hooks can be a very powerful tool that allows full Unity API functionality in multiple scenarios. In the cases above, keyword validation can be a common use. Other organizations may find other use-cases though.

Be sure and leave us a comment below if you have any questions/concerns or just want to talk about the featured script hooks. Next time, we will be looking at an entirely new batch of Unity Script Hooks categorized under indexing.