cancel
Showing results for 
Search instead for 
Did you mean: 

How can I check if a document is locked from A Custom Action Script

Casey_Tyler
Confirmed Champ
Confirmed Champ

I am having trouble with support tickets being opened because changes are not being saved. It is always the issue of the document being locked by someone else. I would like to create a custom action script to check if a the document is locked. If it is, grey out the save button and show hidden text that states that another user has the from locked. The problem is I cannot use DocumentLock on an instance of a form. Does anyone have any ideas on how to accomplish this or if it is at all possible. 

I am using OnBase 16. 

1 ACCEPTED ANSWER

Casey_Tyler
Confirmed Champ
Confirmed Champ

Hi Tyler,

Thank you so much for the reply.

Is there any way to indicate to the user that a document is locked in a more conspicuous way in the unity client. Currently you can click on the submit button without any feedback that the form is not saved. I am just trying to figure out a more apparent way to first,  demonstrate that the document is locked. Second, show the document has not been saved. 

Casey

View answer in original post

5 REPLIES 5

Tyler_Sorber
Star Collaborator
Star Collaborator

Hi Casey

From the looks of things, you are using Unity Forms.  Unfortunately, there are a few limitations that you will run into.  Unfortunately, the Document Object is not accessible from a Custom Action Script. This is because the form may not yet be saved, resulting in a document.  This makes the Document.Lock method unattainable.  Additionally, this type of script will run Server Side, making it not possible to enable/disable buttons and react with the UI.

As a recommendation, I would suggest looking into use of WorkView or EForms.  WorkView should not present this locking type functionality when using the Objects within a Class.  EForms will allow more control Client Side with the use of JavaScript.

Casey_Tyler
Confirmed Champ
Confirmed Champ

Hi Tyler,

Thank you so much for the reply.

Is there any way to indicate to the user that a document is locked in a more conspicuous way in the unity client. Currently you can click on the submit button without any feedback that the form is not saved. I am just trying to figure out a more apparent way to first,  demonstrate that the document is locked. Second, show the document has not been saved. 

Casey

As mentioned in the response above, there is little Client Side functionality that can be done in the context of Unity Forms. I would suggest the use of Workflow for Verification (still limiting the immediate visual context), or the use of EForms with JavaScript.

Casey,

Have you looked in to the Document Type setting in Config for "Display Message When Document is Locked?" This can be found in the Rendition / Revision settings for the document type. It will prompt the user when they open up the Unity Form (or any type of document) that someone else has it locked for editing.

Nick