I am trying to set up a one-way sync between Azure DevOps (source) and Jira Cloud (destination). I have the sync working with the exception of the Target Date field.
But keep getting an error when trying to format the data as a date. When I try to put that data into a text field for troubleshooting, I get a weird field value ([B@2abd3e2c). I feel like I’m close but missing something obvious, has anyone else had issues with this and if so, how did you resolve them?
Thanks!
Comments:
Jose Pablo Alpizar Hidalgo commented on 15 August 2022
Confirmed. The Target Date field is set up as a Date/Time field in ADO. I first tried to set this up as a visual connection with a small script to copy the value over but that didn’t work so I’ve setup a scripted connection.
The error I get is: Cannot format given object as a Date.
Comments:
Ariel Aguilar commented on 16 August 2022
Hi Chris,
I guess you are trying to sync to a date and time picker custom field in Jira Cloud?
Kind regards,
Ariel
Chris Rogers commented on 17 August 2022
Hi Ariel,
I am trying to take a work item in Azure DevOps and sync several fields into an issue in Jira Cloud. I’ve got the rest of the sync working, but the date/time picker from Azure DevOps (named Target Date) syncing into Jira Cloud (also named Target Date) is proving to be a challenge.
Ariel Aguilar commented on 17 August 2022
Try this:
issue.customFields."Target Date".value = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").parse(replica.customKeys."Target Date".replace("Z","CST"))
When parsing the text the Z it is expecting a value instead of variable, so to get it sorted we are replacing the Z by an abbreviation of the system timezone so make sure the value gets properly added. Otherwise, so might get the value added with the default UTC offset timezone provided by the API.
Kind regards,
Ariel
Chris Rogers commented on 19 August 2022
Hi Ariel,
Thanks! This was what I was looking for and worked wonderfully; the time zones don’t match between the instances but we can live with that for now.