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

A new feature has been added to OnBase 14 to store revision of an Eform document with a comment. Currently if an EForm document is revisable, then any change in a keyword or non-keyword field will prompt the user to store the document as a new document or as a new revision. A revisable document will be stored as a new document if there is change in the keyword fileds on the document, otherwise it can be stored as a new revision. This new feature gives users control over storing revisions of an EForm document.

Implementation

In order to store a document as a new EForm Revision, we need to create an EFormRevisionProperties object using CreateStoreEFormRevisionProperties method using the Hyland.Unity.Storage object.

CreateStoreEFormRevisionProperties takes in a document which is of type EForm document type as it's input.

 EFormRevisionProperties has the following methods:

  •  AddField - To add a new fields to EForm Document
  • AddKeyword - To add a new keyword
  • AddKeywordRecord - To add a new Keyword Record
  • Clear - To remove all the added values and clear the existing values
  • GetRecordType - Gets the record type of the record that the keyword is a member of
  • RemoveFiled - Removes filed from fields collection
  • RemoveKeyword - Removes keyword from the stand-alone or single instance keyword type
  • RemoveKeywordRecord - Removes Multi-instance keyword record
  • UpdateField - Updates a new filed, adds a new one if it does not exist or removes a field if the value is null or empty string
  • UpdateKeyword - Updates a stand-alone or single instance keyword
  • UpdateKeywordRecord: Updates a multi-instance keyword record

And the following properties:

  • Comment - Comment for the new Revision
  •  EForm - EForm for the new Revision

This properties object will be passed into a new method that was created in Storage class for this purpose, StoreNewEFormRevision.

This method returns a Document object which is the new revision for the existing document or null if the storage is not successful.  

Example

The following steps describe how to store a revision:

  1. Get the Application object.
  2. Get Storage object from Application.
  3. Get a document of type EForm.
  4. Call CreateStoreEFormRevisionProperties using Storage object by passing in the Document obtained above. StoreEFormRevisionProperties object is returned.
  5. Set properties of StoreEFormRevisionProperties as needed.
  6. Call StoreNewEFormRevision(properites using Storage by passing in the above StoreNewEFormRevision object. This returns a new EForm revision document.

A simple example to store revision with comment is given below.

Storage storage = application.Core.Storage;Document eFormDocument = application.Core.getDocumentById(docId);StoreEFormRevisionProperties properties = storage.CreateStoreEFormRevisionProperties(eFormDocument);properties.Comment = "This is a new revision";Document newRevision =  storage.StoreNewEFormRevision(properites);

Specifics

It must be noted that when adding/updating a field, neither the field name or the field value can be null. If the field already exists on the document, then it will not be added again. An InvalidOperationException specifying that, "The Specified Field exists in the EForm", will be thrown.

In addition, a document must be associated with an EForm to be stored as a EForm revision and StoreEFormRevisionProperties cannot be null. In both of these cases a NullArgumentException will be thrown. 

StoreNewEFormRevision method can safely handle Unicode characters as well.

Maximum length of a comment is 250 characters. If the length is more than 250, it will be truncated. This is important to keep in mind since some would expect an Exception to be thrown.

In Conclusion

This new method gives full control to a user to determine how a document is stored as a new eForm revision, giving you the ability to add a comment, a new field, keyword or even a new keyword record which could not have been done before.