Skip to main content

Groovy Script - Update the Document Revision Number to 2 Digits if it is in 1 Digit and is Numeric only, after the Document is Uploaded

Description: Sample Groovy Script to update the document revision number to 2 digits if it is 1 digit and numeric only, after the document is uploaded.

Context: Document

Document Type: File

Remark: Accessible in 'Post' task mode only.

Script:

def execute(){
DocumentVO document = documentService.getDocumentDetails();
String revision = document.getRevision();
if (revision.length() == 1 && revision.matches("[0-9]+")) {
documentContext.getDocVO().revision = "0"+revision;
documentService.updateDocument(documentContext);
}
}
Did this answer your question?