Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,552,107
Community Members
 
Community Events
184
Community Groups

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?

3 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.

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jun 28, 2018

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?

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 01, 2018

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 ?

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Apr 25, 2019

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 

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 06, 2019

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

I have same issue.

 

JIRA DATE Format: '2020-05-12T17:36:00.000-0500'

Confiform date: entry.TestDate.jiraDateTime

 

Tried format: entry.TestDate.formatDate(yyyy-MM-dd'T'HH:mm:ss.SSSZ) ( Actual time is May 12, 2020 01:30 )

JIRA output: 11/May/20 8:30 PM

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 11, 2020

So in the mapping  you need to set this as 

"some_jira_datetime_field":"[entry.TestDate.jiraDateTime] 

 Assuming you have "TestDate" as a date/datetime field in ConfiForms 

I tried that one but didn’t help

In confiform I set field as datetime 

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 12, 2020

OK, and what is the problem? You have mentioned you are having the same issue, but what exactly is your issue? 

I see the time difference in your examples and that might be the difference in timezones you have for Confluence/Jira. Or the differences in how your profiles are set in Confluence /Jira and if they use the same "timezone"

am in central timezone.


Issues is the time which am choosing in confiform is central timezone but when I send to jira the time got change.

But when I am doing manually in jira I cloud see datetime in cst 

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 12, 2020

And you servers have different time? Are they in a different timezone?

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 12, 2020

And that time differs from your time 7 hours?

Confluence 

system timezone etc/utc 

 

jira

time zone gmt-06:00 chicago

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 12, 2020

And this is the answer, right? That is why you see a different time in Jira (compared to Confluence)

is that possible to format datetime ? 

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 12, 2020

Where? Where do you want to format datetime? In ConfiForms?

Yes, we do have various functions, including the one to formatDate (and time)

https://wiki.vertuna.com/display/CONFIFORMS/Virtual+functions

confiform, is there any way to substract time in formatDate? like -86400000 milliseconds

"date_field": "[entry.TestDate.formatDate(yyyy-MM-dd'T'HH:mm:ss.SSSZ)]" is that possible to do changes here for my requirement.

I’ve used the following in some of my projects to add or subtract time:

[entry.somedatefield.timestamp.add(86400000)]

to subtract just add a “-“ sign in front of the milliseconds.

this can be found on the Virtual Functions page Alex mentioned above by searching “add(number)”. It’s a very useful page.

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 12, 2020

Yes, that's right. Thanks @Chris_Stewart 

Then something like this:

[entry.somedatefield.timestamp.add(-86400000).jiraDateTime]

[entry.somedatefield.timestamp.add(-86400000).jiraDateTime] - worked

Thanks @Alex Medved _ConfiForms_ and @Chris_Stewart 

Comment

Log in or Sign up to comment