Skip to main content

Groovy Script - Embed Latest Attributes in Downloaded Files

Description: Sample Groovy Script to automatically embed the updated system and Custom Attributes in the downloaded files. This script can be configured with a Trigger within a visual Workflow service task.

Context: Document

Document Type: File (only DOCX and XLSX file formats are supported)

Remark: Supported in Post task mode only

Script:

def execute(){

FileAttributesVO fileAttributesVO = new FileAttributesVO();

HashMap<String,String> propAttributeMapping = new HashMap<>();
//propAttributeMapping.put(IDocumentAttribute.REV,"1"); //standard attributes
propAttributeMapping.put(IDocumentAttribute.REV,"Revision Number");
propAttributeMapping.put(IDocumentAttribute.STATUS,"Status");
propAttributeMapping.put(IDocumentAttribute.POI,"Purpose");
propAttributeMapping.put("Approved By","Approved By");
propAttributeMapping.put("Role","Role");
propAttributeMapping.put("Office","Office");
propAttributeMapping.put("Checked by","Checked by");
fileAttributesVO.setPropAttributeMapping(propAttributeMapping);
documentService.writeAttributesInFile(fileAttributesVO);

}
Did this answer your question?