import("DocumentTemplate_lib"); import("system.neon"); import("system.vars"); // note: could not use only the valueProcess from $field.Content because then it refreshed $field.Content just before save. // --> only set in $field.Content.valueProcess if $field.Content is null and set it from here only if MASK triggered change if((vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT || vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW)) { [content, type] = DocumentTemplateUtils.getTemplateContent(vars.get("$field.DOCUMENTTEMPLATEID"), new FileUpload(vars.get("$local.value"))); vars.set("$context.currentTemplateType", type); vars.set("$field.content", content) }