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 Chris Stewart 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.

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

Hi Alex,

my question is as per below link we can use fields parameter in REST API for searching entries in confiforms. so is it possible to use the fields parameter to create an entry ?

 https://wiki.vertuna.com/display/CONFIFORMS/REST+API#RESTAPI-Searchentries 

Sorry, I dont quite understand... you refer to the API that helps you to search ConfiForms entries - how is this connected to "create and entry"? Creating an entry can be done using this API - https://wiki.vertuna.com/display/CONFIFORMS/REST+API#RESTAPI-Createentry

Comment

Log in or Sign up to comment
Community showcase
Published in Jira

[Survey] Development tools and DevOps - share your thoughts!

Hey Community! I work at Atlassian in product marketing and we are conducting a survey to better understand how people feel about their development tool chain and DevOps. We would love if you could...

37 views 0 0
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you