It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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?

2 comments

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

Like 1 person likes this

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.

Like 1 person likes this

Hi Alex ,

Is the "fields" parameter in REST API call applicable only to search entries ? shall we use it in create entry REST API call ? will it work ?

Not sure I understand the question here, sorry... the format for the JSON is based on the spec given by Atlassian.

 

https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/

 

This is where this "fields" node comes from

Comment

Log in or Sign up to comment
Community showcase
Posted 6 hours ago in United States

Request a Demo

Questions? Want to see a demo of the Atlassian tools? Add a comment below or Send us an email

43 views 2 1
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