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

This helper function is not available in the filter.action? How can I retrieve another date format than the double when using the search function of the REST api?

You can specify the "fields" parameter in REST API call as described here https://wiki.vertuna.com/display/CONFIFORMS/REST+API#RESTAPI-Searchentries to decorate/transform the field value as needed (with virtual functions)

Thanks Alex, it works.

Comment

Log in or Sign up to comment
Community showcase
Posted Tuesday in United States

Topic Tuesday: What's your favorite topic?

Good morning All, Our goal is to get you into the habit of while enjoying your favorite morning drink you are checking the NOVA "space" for topics and comments. Your input is really needed and...

63 views 4 0
View post

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