Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Adding Jira Comments through Confiforms

Rayman Bacchus
Contributor
January 23, 2025

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"}],

1 answer

1 accepted

0 votes
Answer accepted
Alex Medved _ConfiForms_
Community Champion
January 23, 2025

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

Rayman Bacchus
Contributor
January 25, 2025

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]&timestamp=[now]&CIAMAmountid=${iftttResult_JIRAComment01.id} -  This is where I think I pull only id

 

Alex Medved _ConfiForms_
Community Champion
January 26, 2025

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

  • Save the whole response into CIAMAmountid and then in the view, when adding the ConfiForms Field macro to show the specific field you can put the field name with asJSON transforming function to have something like CIAMAmountid.asJSON.id to show the ID 
  • Have 2 sequential ConfiForms IFTTTs of "Create/Update Confiforms Entry" type with parameters as follows
    • entryId=[entry.id]&timestamp=[entry._now]&CIAMAmountid=[iftttResult_JIRAComment01]
    • entryId=[entry.id]&CIAMAmountid=[entry.CIAMAmountid.asJSON.id]

 

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

Like Rayman Bacchus likes this
Rayman Bacchus
Contributor
January 26, 2025

As always Alex you are a genius and abosultely great at what you do! 

THank you so much - I went with Option #1:

  • Save the whole response into CIAMAmountid and then in the view, when adding the ConfiForms Field macro to show the specific field you can put the field name with asJSON transforming function to have something like CIAMAmountid.asJSON.id to show the ID 
Peter Baschan
Contributor
July 14, 2025

Hi @Alex Medved _ConfiForms_ 

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:

  • 'comment' - textarea
  • 'JiraId' - text

 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

Alex Medved _ConfiForms_
Community Champion
July 14, 2025

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

 

Peter Baschan
Contributor
July 14, 2025

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.

Alex Medved _ConfiForms_
Community Champion
July 14, 2025

What do you POST? May be the contents of a JSON payload is what is broken?

Peter Baschan
Contributor
July 15, 2025

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!

Alex Medved _ConfiForms_
Community Champion
July 15, 2025

Of course you can

Should be using the escapeJSON function when you pass your value in the JSON mapping

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events