Quick demo on how to apply "Field Definition Rule" on Attachment picker to filter out attachments that dont end with "xls" extension
Attachment picker works on Confluence objects "Attachments" - https://docs.atlassian.com/atlassian-confluence/5.8.6/com/atlassian/confluence/pages/Attachment.html
Which means, we can access ANY property of these objects - such as fileName (as in this example) or labels, via "labelling.label" (which means we call "getLabelling" then call "getLabel" on the underlying objects), or any other "get" method
ConfiForms Form Definition | ||
---|---|---|
| ||
-- rules |
Storage format for the demo
Code Block |
---|
<ac:structured-macro ac:macro-id="6e5b54b1-c627-4c0d-939e-562c4d7af424" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">myform1</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="6758acc5-e724-4a71-91c0-8cca85895bf2" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="embedded">true</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<ac:structured-macro ac:macro-id="2f5a2eaf-43f8-49c7-8d87-dc4b10bd0c57" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">only</ac:parameter>
<ac:parameter ac:name="fieldLabel">Only with excel files</ac:parameter>
<ac:parameter ac:name="fieldDescription">filter attachments and show only excel files</ac:parameter>
<ac:parameter ac:name="type">checkbox</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="63c8d4c6-34f8-4983-8152-d834319a11d1" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">ap</ac:parameter>
<ac:parameter ac:name="fieldLabel">Attachments</ac:parameter>
<ac:parameter ac:name="type">attachment</ac:parameter>
</ac:structured-macro>
</p>
<p>
<br/>
</p>
<p>-- rules</p>
<p>
<ac:structured-macro ac:macro-id="14060721-e34c-4786-a78b-d64f3a5a7ef4" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="condition">only:true</ac:parameter>
<ac:parameter ac:name="fieldName">ap</ac:parameter>
<ac:parameter ac:name="values">ap.asAttachment.fileName:*xls</ac:parameter>
<ac:parameter ac:name="action">Apply Filter on a field</ac:parameter>
<ac:parameter ac:name="actionFieldName">only</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="f341fde6-dd62-48da-8846-29739b928bd5" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="condition">only:false</ac:parameter>
<ac:parameter ac:name="fieldName">ap</ac:parameter>
<ac:parameter ac:name="values">*</ac:parameter>
<ac:parameter ac:name="action">Apply Filter on a field</ac:parameter>
<ac:parameter ac:name="actionFieldName">only</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro> |