Skip to main content
All CollectionsSystem TasksWorking with Groovy ScriptsGroovy Script Library
Groovy Script - Enable the 'Include QR code' option in the Download Preference

Groovy Script - Enable the 'Include QR code' option in the Download Preference

Updated over 3 weeks ago

Description: Sample Groovy script to enable the 'Include QR code' option in download preference. It can apply to both 'Static' and 'Dynamic' QR code types.

Click here to learn more.

Context: Document

Remark: Accessible in 'On Load' task mode only.

Script:

def execute(){

boolean checked = true;

boolean unchecked = false;

DocumentVO document = documentService.getDocumentDetails();

JsonArray optionList = new JsonArray();

JsonObject qrCodeOption = new JsonObject();

qrCodeOption.addProperty(IGroovyConstant.VISIBLE, true);

qrCodeOption.addProperty(IGroovyConstant.EDITABLE, true);

qrCodeOption.addProperty(IGroovyConstant.DEFAULT_VALUE, checked);

qrCodeOption.addProperty(IGroovyConstant.OPTION_NAME, IGroovyConstant.EMBED_QR_CODE_OPTION);

optionList.add(qrCodeOption);

/*

JsonObject fileRenameOption = new JsonObject();

fileRenameOption.addProperty(IGroovyConstant.VISIBLE, true);

fileRenameOption.addProperty(IGroovyConstant.EDITABLE, true);

fileRenameOption.addProperty(IGroovyConstant.DEFAULT_VALUE, unchecked);

fileRenameOption.addProperty(IGroovyConstant.OPTION_NAME, IGroovyConstant.RENAME_FILE_OPTION);

optionList.add(fileRenameOption);

*/

document.setResponseStatus(false);

document.setDynamicObject(optionList.toString());

return document;

}



Did this answer your question?