How to submit attachments on JIRA Issues using Confiforms

Fred Williams March 30, 2018

I am trying to use confiforms to link to my current jira project however I can't figure out how to write the code so that way they are linked. Ideally, I want the attachments from the confiform to be submitted in the Jira Project. Below I have posted my code:

 

{
    "fields": {
       "project":
       { 
          "key": "ILS"
       },
       "summary": "[entry.Summary]",
	   "attachment": "[entry.Attachments]",
       "description": "[entry.Description]",
       "issuetype": {
          "name": "Task"
       }
   }
}

1 answer

1 vote
Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 28, 2018

Please see the following tutorial on Creating Jira issues in Confluence using ConfiForms @Fred Williams

It also shows you how to send over attachments...

Quick answer is to drop a ConfiForms Field (referencing your file/attachments field) inside the same IFTTT macro body what creates the Jira issue and you are good

Gemma Haenen August 28, 2018

I don't see a Confiforms Fields. Only Confiforms Forms Field.

Is that the one?

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 28, 2018

Yes, Confiforms Forms Field is the name of the macro

 

Let us know if you need any help, you can contact our support via https://wiki.vertuna.com/display/VERTUNA/Support+Request+Form

Paul Ward September 11, 2018

While this works for users logged into Confluence, for users not logged in a whole raft of permission related errors are thrown (yes, anonymous is set). My counterpart moved to the IFTT webservice action to get around this, but that does not support attachmenst in the same way

 

all my search for attaching files using the rest API result in Java, PHP etc. answers

 

How do I either:

1) use the IFFT Create Jira action in a form used by non-confluence users

2) attach  file using the IFFT Webservice action

Paul Ward September 11, 2018

I'll create a new request ...

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 11, 2018

Hi @Paul Ward

 

With built-in IFTTT action to create Jira Issues (which uses Application link) you have an easy way to send attachments to created Jira ticket

This relies on the application link between your Jira and Confluence and uses that as an auth story.

 

When you use generic web services requests then there is no magic done around uploading attachments... as well.. the request is generic and you tell it what to do

 

Below is the storage format for the workflow that creates Jira ticket, saves it back to ConfiForms entry and uploads the file as attachment and creates a remote link 

 

Everything uses the webservices connection


<ac:structured-macro ac:macro-id="634f4a34-b8ba-464d-b222-e123d65cc4e0" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">ji</ac:parameter>
<ac:parameter ac:name="showOnlyOwnRecords">true</ac:parameter>
<ac:parameter ac:name="registrationFormTitle">Create JIRA issue with ConfiForms Webservice connection</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="dd25632e-211e-4820-8754-836d4ade9236" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="overrideSaveButtonLabel">Create</ac:parameter>
<ac:parameter ac:name="registrationButtonLabel">Register me</ac:parameter>
<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="8a572845-1d28-4560-a4d8-f8102317e419" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">summary</ac:parameter>
<ac:parameter ac:name="fieldLabel">Summary</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="2e5a8660-272b-43f6-801d-a3131c3665c5" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">desc1</ac:parameter>
<ac:parameter ac:name="fieldLabel">Description</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="7d641f3b-1fd7-4e47-a63e-a2b040782730" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">desc2</ac:parameter>
<ac:parameter ac:name="fieldLabel">More details:</ac:parameter>
<ac:parameter ac:name="type">textarea</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="7c8f347e-7704-441f-92f2-990cac31a7d5" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="css">width:100px;</ac:parameter>
<ac:parameter ac:name="fieldName">jk</ac:parameter>
<ac:parameter ac:name="fieldLabel">Jira key</ac:parameter>
<ac:parameter ac:name="type">read_only</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="a06f0ccf-0e36-4d07-b47d-cb38a345c0fe" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="condition">id:[empty]</ac:parameter>
<ac:parameter ac:name="fieldName">jk</ac:parameter>
<ac:parameter ac:name="action">Hide field</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="1b02c04d-3480-4397-9ddb-9b0e556b4351" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">fi</ac:parameter>
<ac:parameter ac:name="fieldLabel">fi</ac:parameter>
<ac:parameter ac:name="type">file</ac:parameter>
</ac:structured-macro>
</p>
<ac:structured-macro ac:macro-id="53fe3481-065d-41c4-be5d-a7a1268b0450" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="action">WebService Request</ac:parameter>
<ac:parameter ac:name="extras">4bb4c41a51f289a07507d50a1b841a4d</ac:parameter>
<ac:parameter ac:name="event">onCreated</ac:parameter>
<ac:parameter ac:name="title">/rest/api/2/issue/</ac:parameter>
<ac:parameter ac:name="extras2">X-Atlassian-Token: no-check;Content-Type: application/json;Content-Type:charset=UTF-8</ac:parameter>
<ac:parameter ac:name="who">POST</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="46d25e82-d4db-4e38-9b96-f5c6159c473f" ac:name="noformat" ac:schema-version="1">
<ac:plain-text-body><![CDATA[{
"fields": {
"project":
{
"key": "JTEST"
},
"summary": "[entry.summary.escapeJSON]",
"assignee":{"name":"admin"},
"description": "[entry.desc1.escapeJSON] \n [entry.desc2.escapeJSON]",
"issuetype": {
"name": "Bug"
}
}
}]]></ac:plain-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<br/>
</p>
<p>
<br/>
</p>
<ac:structured-macro ac:macro-id="f00edb26-9174-4f7a-9570-d598e92dce10" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="extras4">true</ac:parameter>
<ac:parameter ac:name="action">Create ConfiForms Entry</ac:parameter>
<ac:parameter ac:name="event">onCreated</ac:parameter>
<ac:parameter ac:name="title">entryId=[entry.id]&amp;jk=${iftttResult_0}</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="fe3beac3-95ef-49ae-b42c-e3168a2f57b7" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="action">WebService Request</ac:parameter>
<ac:parameter ac:name="extras">4bb4c41a51f289a07507d50a1b841a4d</ac:parameter>
<ac:parameter ac:name="event">onCreated</ac:parameter>
<ac:parameter ac:name="title">/rest/api/latest/issue/[entry.jk.asJSON.key]/attachments</ac:parameter>
<ac:parameter ac:name="additionalContext">file</ac:parameter>
<ac:parameter ac:name="extras2">X-Atlassian-Token: no-check;</ac:parameter>
<ac:parameter ac:name="who">POST</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="1271c70c-7c2b-4ed2-b009-d2e731ec4a8b" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">fi</ac:parameter>
</ac:structured-macro>
</p>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="d4d6ee84-0f33-4713-b0c4-04baad175345" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="action">WebService Request</ac:parameter>
<ac:parameter ac:name="extras">4bb4c41a51f289a07507d50a1b841a4d</ac:parameter>
<ac:parameter ac:name="event">onCreated</ac:parameter>
<ac:parameter ac:name="title">/rest/api/latest/issue/[entry.jk.asJSON.key]/remotelink</ac:parameter>
<ac:parameter ac:name="additionalContext">file</ac:parameter>
<ac:parameter ac:name="extras2">X-Atlassian-Token: no-check;</ac:parameter>
<ac:parameter ac:name="who">POST</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="56a89f71-7d60-496a-ab45-2d6f6db4bd34" ac:name="noformat" ac:schema-version="1">
<ac:plain-text-body><![CDATA[{
"object": {
"url":"https://wiki.vertuna.com/pages/viewpage.action?pageId=19104427",
"title":"[entry._page.title.escapeJSON]"
}
}]]></ac:plain-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="d309c641-56ef-46cb-b01f-19590d41605e" ac:name="confiform-table" ac:schema-version="1">
<ac:parameter ac:name="formName">ji</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="bb4766d6-cbfe-40c6-ace4-f3dcd21dcc99" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">jk.asJSON.key</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="18b7e9fe-30c3-4a04-886e-6a47446af441" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">created</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>

 

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 11, 2018

Hi @Paul Ward

 

With built-in IFTTT action to create Jira Issues (which uses Application link) you have an easy way to send attachments to created Jira ticket

This relies on the application link between your Jira and Confluence and uses that as an auth story.

 

When you use generic web services requests then there is no magic done around uploading attachments... as well.. the request is generic and you tell it what to do

 

Below is the storage format for the workflow that creates Jira ticket, saves it back to ConfiForms entry and uploads the file as attachment and creates a remote link 

 

Everything uses the webservices connection


<ac:structured-macro ac:macro-id="634f4a34-b8ba-464d-b222-e123d65cc4e0" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">ji</ac:parameter>
<ac:parameter ac:name="showOnlyOwnRecords">true</ac:parameter>
<ac:parameter ac:name="registrationFormTitle">Create JIRA issue with ConfiForms Webservice connection</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="dd25632e-211e-4820-8754-836d4ade9236" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="overrideSaveButtonLabel">Create</ac:parameter>
<ac:parameter ac:name="registrationButtonLabel">Register me</ac:parameter>
<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="8a572845-1d28-4560-a4d8-f8102317e419" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">summary</ac:parameter>
<ac:parameter ac:name="fieldLabel">Summary</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="2e5a8660-272b-43f6-801d-a3131c3665c5" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">desc1</ac:parameter>
<ac:parameter ac:name="fieldLabel">Description</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="7d641f3b-1fd7-4e47-a63e-a2b040782730" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">desc2</ac:parameter>
<ac:parameter ac:name="fieldLabel">More details:</ac:parameter>
<ac:parameter ac:name="type">textarea</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="7c8f347e-7704-441f-92f2-990cac31a7d5" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="css">width:100px;</ac:parameter>
<ac:parameter ac:name="fieldName">jk</ac:parameter>
<ac:parameter ac:name="fieldLabel">Jira key</ac:parameter>
<ac:parameter ac:name="type">read_only</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="a06f0ccf-0e36-4d07-b47d-cb38a345c0fe" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="condition">id:[empty]</ac:parameter>
<ac:parameter ac:name="fieldName">jk</ac:parameter>
<ac:parameter ac:name="action">Hide field</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="1b02c04d-3480-4397-9ddb-9b0e556b4351" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">fi</ac:parameter>
<ac:parameter ac:name="fieldLabel">fi</ac:parameter>
<ac:parameter ac:name="type">file</ac:parameter>
</ac:structured-macro>
</p>
<ac:structured-macro ac:macro-id="53fe3481-065d-41c4-be5d-a7a1268b0450" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="action">WebService Request</ac:parameter>
<ac:parameter ac:name="extras">4bb4c41a51f289a07507d50a1b841a4d</ac:parameter>
<ac:parameter ac:name="event">onCreated</ac:parameter>
<ac:parameter ac:name="title">/rest/api/2/issue/</ac:parameter>
<ac:parameter ac:name="extras2">X-Atlassian-Token: no-check;Content-Type: application/json;Content-Type:charset=UTF-8</ac:parameter>
<ac:parameter ac:name="who">POST</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="46d25e82-d4db-4e38-9b96-f5c6159c473f" ac:name="noformat" ac:schema-version="1">
<ac:plain-text-body><![CDATA[{
"fields": {
"project":
{
"key": "JTEST"
},
"summary": "[entry.summary.escapeJSON]",
"assignee":{"name":"admin"},
"description": "[entry.desc1.escapeJSON] \n [entry.desc2.escapeJSON]",
"issuetype": {
"name": "Bug"
}
}
}]]></ac:plain-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<br/>
</p>
<p>
<br/>
</p>
<ac:structured-macro ac:macro-id="f00edb26-9174-4f7a-9570-d598e92dce10" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="extras4">true</ac:parameter>
<ac:parameter ac:name="action">Create ConfiForms Entry</ac:parameter>
<ac:parameter ac:name="event">onCreated</ac:parameter>
<ac:parameter ac:name="title">entryId=[entry.id]&amp;jk=${iftttResult_0}</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="fe3beac3-95ef-49ae-b42c-e3168a2f57b7" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="action">WebService Request</ac:parameter>
<ac:parameter ac:name="extras">4bb4c41a51f289a07507d50a1b841a4d</ac:parameter>
<ac:parameter ac:name="event">onCreated</ac:parameter>
<ac:parameter ac:name="title">/rest/api/latest/issue/[entry.jk.asJSON.key]/attachments</ac:parameter>
<ac:parameter ac:name="additionalContext">file</ac:parameter>
<ac:parameter ac:name="extras2">X-Atlassian-Token: no-check;</ac:parameter>
<ac:parameter ac:name="who">POST</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="1271c70c-7c2b-4ed2-b009-d2e731ec4a8b" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">fi</ac:parameter>
</ac:structured-macro>
</p>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="d4d6ee84-0f33-4713-b0c4-04baad175345" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="action">WebService Request</ac:parameter>
<ac:parameter ac:name="extras">4bb4c41a51f289a07507d50a1b841a4d</ac:parameter>
<ac:parameter ac:name="event">onCreated</ac:parameter>
<ac:parameter ac:name="title">/rest/api/latest/issue/[entry.jk.asJSON.key]/remotelink</ac:parameter>
<ac:parameter ac:name="additionalContext">file</ac:parameter>
<ac:parameter ac:name="extras2">X-Atlassian-Token: no-check;</ac:parameter>
<ac:parameter ac:name="who">POST</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="56a89f71-7d60-496a-ab45-2d6f6db4bd34" ac:name="noformat" ac:schema-version="1">
<ac:plain-text-body><![CDATA[{
"object": {
"url":"https://wiki.vertuna.com/pages/viewpage.action?pageId=19104427",
"title":"[entry._page.title.escapeJSON]"
}
}]]></ac:plain-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="d309c641-56ef-46cb-b01f-19590d41605e" ac:name="confiform-table" ac:schema-version="1">
<ac:parameter ac:name="formName">ji</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="bb4766d6-cbfe-40c6-ace4-f3dcd21dcc99" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">jk.asJSON.key</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="18b7e9fe-30c3-4a04-886e-6a47446af441" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">created</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
Paul Ward September 12, 2018

@Alex Medved _ConfiForms_

Alex - the links to your reply leads to a 404 and the content was chopped short in the email itself. Could you please respond again, perhaps to my post here: https://community.atlassian.com/t5/Jira-questions/Attaching-files-to-Jira-issues-from-Confluence-offline-user/qaq-p/888576

 

cheers

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 12, 2018

It's weird, as I have provided you with a complete answer showing how to configure IFTTTs to do that.. and it was visible here for me, but now has disappeared

some anti-spam or something

how the hell I can provide the answer if this get's stripped !? Ohh

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 12, 2018

Trying to answer this question again in your linked question... @Paul Ward

Suggest an answer

Log in or Sign up to answer