Skip to main content

Groovy Script - Embed Latest Attributes in Downloaded Files

Updated this week

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?