The Unity API is a powerful direct line to the OnBase database. It gives you programmatic access to most key features of OnBase. But, what about cases where it would be convenient to use UI from the Unity Client? Like, for example, to display a document or view a Work Flow queue? For those cases, there is the Unity Client Automation API.
The Unity Client Automation API is a way to call into the Unity Client from the Unity API. It gives you the ability to display documents, folders, Document Composition templates, and Work Flow queues using the Unity Client. You have great flexibility in deciding what to display. For Documents, as an example, you could choose to show a single document, a Document Type, or the results of a Custom Query by sending a Unity Client Automation command to an already open instance of the Unity Client.
You can use the Unity Client Automation API after connecting to the Unity API like normal, or you can connect using an existing Unity Client session. This will allow you to use the full Unity API functionality (including Unity Client Automation functionality) using a currently existing Unity Client session.
Hyland.Unity.Application app = Hyland.Unity.Automation.UnityClientAutomation.ConnectToExistingUnityClientSession();
<ServiceMode enabled="true" allowExit="true" autoLaunch="true">
<Feature name="Unity Client Automation API" enabled="true"/>
Let's say we want to display all the documents of type "AP - Checks" in the Unity Client. To do so, first, we'll connect to OnBase through the Unity API:
Hyland.Unity.Application app = Hyland.Unity.Application.Connect(authenticationProperties);
Next, we get the UnityClientAutomation object:
Hyland.Unity.Automation.UnityClientAutomation unityClientAutomation = app.GetAutomation<UnityClientAutomation>();
We want to display all the documents of the type "AP - Checks" so let's get that type:
DocumentType docType = app.Core.DocumentTypes.Find("AP - Checks");
Then we create the DocumentListProperties by passing in this Document Type:
DisplayDocumentListProperties displayDocumentListProperties = UnityClientAutomation.CreateDisplayDocumentListProperties(docType);
Finally, we display the documents:
unityClientAutomation.DisplayDocumentList(displayDocumentListProperties);
A Unity Client window will appear with a document list of all AP - Checks documents. You can also add Keyword or Date restrictions to DisplayDocumentListProperties to reduce the results set. Folders and Work Flow work very similarly.
For more information about the Unity Client Automation API, including details on how to implement asynchronous requests, see the OnBase SDK.
The Unity Client Automation API is a tool that allows developers to create custom code to manipulate an instance of the Unity Client. Redirecting the client, opening particular documents, modifying keywords, and more is possible using the Unity Client Automation API. Hopefully this gives developers the flexibility to customize their usage of the Unity Client to their needs.
Join us next week when when we discussion caching in Unity Scripts!