How do I modify the ConfiForm date to the format needed by JIRA

I'm creating a form using ConfiForms to create a JIRA task. Here is the code that I currently have located in a IFTTT to create JIRA Issue. Then a No Format macro inside of that, which contains the following code:

{

  "fields": {
     "project":
     {
     "key": "TASK"
     },
     "summary": "[entry.summary]",
     "description": "[entry.details]",
     "issuetype": { "name": "Task" },
     "assignee": { "name": "[entry.user]" },
     "customfield_20721": [{"id":"[entry.categories]"} ],
     "duedate":"[entry.duedate]
  }
}

This code worked perfectly when the duedate was manually entered (coded date) with the expected format ("duedate":"2012-10-10" ). Unfortunately, the format that confiForms is passing through is MMM dd, yyyy; which causes a "Could not prepare JSON..." error. 

 

Q: How can I change the format from MMM dd, yyyy to the format that JIRA is expecting: yyyy-MM-dd?

1 comment

In case someone else comes across this issue. The solution was: "duedate":"[entry.duedate.jiraDate]"

Note:
The first "duedate" is the JIRA field that the data will go to.

The duedate in the [entry.duedate...] is the name of my confiform field that the data is being pulled from. 

I probably should not have named my form field the same as the JIRA field.

Please look at Virtual functions in ConfiForms. We have some helper functions for exactly your needs

jiraDate

Same as "formatDate" method above, but specifies constant dateformat pattern (yyyy-MM-dd), suitable for JIRA REST API

 

jiraDateTime

Same as "formatDate" method above, but specifies constant dateformat pattern ("yyyy-MM-dd'T'HH:mm:ss.SSSZ"), should be compatible with ISO 8601 standard as JIRA requires when setting timestamps to JIRA fields

Comment

Log in or Sign up to comment
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Monday in Agility Beta

We've moved!

A note to all watchers that we've moved to a new community home... https://community.atlassian.com/t5/Agility/ct-p/agility Please update your notification subscriptions to keep across the ...

83 views 1 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you