Skip to main content

Groovy Script - Access all Attributes of a Document and its Attachments

Description: Sample Groovy Script to access all Attributes of a document and its attachments.

Context: Document

Document Type: File
​

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?