Skip to main content

Groovy Script - Stop the Upload if the Document doesn't have an Attachment and Display a Message

Description: Sample Groovy Script to stop the document upload if the document does not have an attachment and display a message.

Context: Document

Document Type: File

Remark: Accessible in 'Pre' task mode only.

Script:

def execute(){
DocumentVO document = documentService.getDocumentDetails();
if (!document.getHasAttachment()) {
document.setResponseStatus(false);
document.setResponseMessage("Uploaded document should have attachment.");
}
return document;
}
Did this answer your question?