Skip to main content
All CollectionsSystem TasksWorking with Groovy ScriptsGroovy Script Library
Groovy Script - Access all attributes of Document and it's attachment
Groovy Script - Access all attributes of Document and it's attachment
Updated yesterday

Description: Sample groovy script to access all attributes of document and it's attachment

Context: Document

Remark: ---

Script:

def execute(){

DocumentVO document = documentService.getDocumentDetails();

String fileName = document.getFileName();

String docRef = document.getDocRef();

String revision = document.getRevision();

String documentTitle = document.getDocTitle();

String purposeOfIssue = document.getPurposeOfIssue();

String status = document.getStatus();

String revisionNotes = document.getRevisionNotes();

boolean hasAttachment = document.getHasAttachment();

String attachedFileName = document.getAttachedFileName();

boolean isPrivate = document.isPrivate();

// only accessible in POST task mode

String documentPath = document.getDocumentPath();

String fileSize = document.getFileSize();

String projectName = document.getProjectName();

String publishDate = document.getPublishDate();

String publisherEmail = document.getPublisherEmail();

String publisherOrganization = document.getPublisherOrganization();

String ver = document.getVer();

List<DocAttachmentVO> attachments = documentService.getAttachmentDetails();

HashMap attachmentMap = new HashMap();

for(DocAttachmentVO attachment : attachments){

String aFileName = attachment.getFileName();

String aFileSize = attachment.getFileSize();

attachmentMap.put(aFileName, aFileSize);

}

}



Did this answer your question?