I use Confiforms to create and update JIRA's as necessary. There are two IFTTT's one for when an intake is created it will CREATE the Jira page and one if the Confluence page that displays intake details is updated then another IFTTT performs an update. All that works fine.
However, I am wondering if I can add comments to the JIRA
I currently have this (shortened example below):
So am wondering if I can add something like "comments" : "[entry.IntakeMins.escapeJSON]"
so an comment can be added to the JIRA page?
{ "fields": { "project": { "key": "******" }, "issuetype" : { "name": "Task" }, "priority" : { "name": "Medium" }, "summary" : "[entry.InitiativeName.escapeJSON]", "assignee" : { "name": "[entry.DefaultAssignee]" }, "customfield_24100" : "[entry.StartDate.jiraDateTime]", "customfield_24101" : "[entry.EndDate.jiraDateTime]", "customfield_30000" : { "value": "Product Family" }, "reporter" : { "name": "[entry.createdBy]" }, "components" : [{"name":"CIAM Work Origination"}],
As far as I know, but you can always check Atlassian documentation on this, the comment needs to be added through a separate API call
https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#api/2/issue-addComment
Little video to help
Thank's as always Alex! That worked - and I can now add a comment to the JIRA page.
What's even better is when I ask for the ifttt_Result
CIAMAmountid=${iftttResult_JIRAComment01}
I get full results. The question is - how do I pull ONLY the id? I tried this:
CIAMAmountid=${iftttResult_JIRAComment01.id}
but that does not seem to work - although I think it should. Any ideas?
To Post the Comment:
Event: onModified
Action: AppLink service
Method: POST
server url: /rest/api/2/issue/[entry.CIAMJiraKey]/comment
custom name for action: JIRAComment01
To Pull Results of Comment Posted:
Event: onModified
Action: Create/Update Confiforms Entry
Parameters to set on the entry: entryId=[entry.id]×tamp=[now]&CIAMAmountid=${iftttResult_JIRAComment01.id} - This is where I think I pull only id
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The thing is, you cannot apply a function on the IFTTT result and ConfiForms does not know for sure if the response was JSON or anything else.
So there are 2 options
BTW, use of "[now]" is incorrect - this will ALWAYS show the current date/time, not the date/time of the update, so I have fixed that
BTW2, the [now] has been deprecated for like 8 years ;-)
Alex
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As always Alex you are a genius and abosultely great at what you do!
THank you so much - I went with Option #1:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Apologies for jumping on this thread, but I have a question. What format do you have to specify the Jira Key to be used successfully in the api link?
I created a simple form with two fields and an IFTTT:
IFTTT:
Event: OnCreated
Action: AppLink Service
Method: POST
Service URL: /rest/api/2/issue/[entry.JiraId]/comment
Result: AddComment
Our Jira Issues have the following format:
[prefix]-[serial number], for example: ABCDE-1234
The above setup gives an 'Unexpected character' error.
Thank you in advance!
Peter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What do you have in the JiraId field?
It is a Jira issue key, as you have in JIra - usuallye it is project-number format, aka ABCDE-1234
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried the field being simple 'text' type and enter ABCDE-1234 - gave the error
I tried the field being a 'Jira Issue' and enter ABCDE-1234 (it recognised the issue on the form perfectly), but on submit it gave the error.
Could there be a security setting in JIRA that prevents updates through the API? We have quite a restricted setup, but then I presume the error message would be different.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What do you POST? May be the contents of a JSON payload is what is broken?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, that was the problem, it is now working. May I be cheeky and ask whether there is a way to have multi-line text in the payload? I have set up the comment field as a TextArea, but if I use line breaks on the form, it will break in the JSON. So either the user has to add \n within the comment box, in which case it will look nice in Jira, but wrong in Confluence, or I have to put a message on the form, to 'do not use line breaks' in which case the comment box in Confluence would not work that well.
My current workaround is I added another field for the user to choose whether they want the comment to be copied over to Jira or not, so they can add fancy comments to Confluence only and 'single-line' ones for both.
Thank you as always!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Of course you can
Should be using the escapeJSON function when you pass your value in the JSON mapping
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.