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);
}
}