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?
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.
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
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
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
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
And you servers have different time? Are they in a different timezone?
And that time differs from your time 7 hours?
And this is the answer, right? That is why you see a different time in Jira (compared to Confluence)
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.
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