I've found that the datepicker field when added as custom field in Jira Product Discovery is incorrectly formattet in the rest API.
Is there a way to format this so i can get the start date of the object returned?
"customfield_10146":"{\"start\":\"2023-11-29\",\"end\":\"2023-11-29\"}"
If it followed the other customfields with more properties i would have expected it to look like "[{"start":""2023-11-29","end":"2023-11-29"}]"
I'm trying to access it like this but it does not give a result because the object is saved as a string:
{{triggerIssue.fields.customfield_10146.start}}
I tried doing a remove("\\") on the string but i'm still not able to select the values.
Yup, that is the "date" format for Jira Product Discovery (JPD): it is a text string representing a range of dates...with no typing or attribute information (at least in automation rules).
You can find other posts where customers used the text functions in automation rules to get at the values in the field, and I suspect the same would be needed to access a date with the REST API functions. I just double-checked and the REST API issue function with ?expand=names does return dates in that format.
Kind regards,
Bill
Too bad that Atlassian did not consider using the same formats, i hope this is included in future optimizations.
I ended up doing a string handling of the field to get the start date of my datepicker in my automation (trigger issue being my issue in project discovery):
{{triggerIssue.fields.customfield_10146.remove("\\").substring(10,20).toDate}}
I used it as part of a compare to see if the date was before or after the other issue in an advance compare:
First value: {{triggerIssue.fields.customfield_10146.remove("\\").substring(10,20).toDate.diff(issue.fields.customfield_10015).days}}
Condition: Greater Than
Second value: 0
And then i found an article describing how to update the datepicker from in an advance editing of the field using below format:
{
"fields": {
"customfield_10146": "{\"start\":\"{{triggerIssue.customfield_10015.jiraDate}}\",\"end\":\"{{triggerIssue.customfield_10015.jiradate}}\"}"
}
}
So it is possible to read and write to the field, but my god it's cumbersome.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am glad to learn you have something that works. Another way to do that would be to use the match() function with a regular expression, as that will be easier to adjust in the future...
As some Atlassian employee posts in the JPD community pages indicate automation work is in progress, I also wonder if that format of that field will change when accessed by automation rules and the REST API. Regardless, I would keep a watch on that rule to ensure it works as expected.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.