Sync DateTime Field in ZD with Date Field in Jira

Originally asked by Shaleen Kukreti on 14 June 2023 (original question)


I am trying to sync a DateTime field from Zendesk to Jira. ZD is in the EST timezone and Jira is in the PST timezone.

ZD:- Event Time (New) - Date(type)

Jira:- Event Time - Date Time Picker

Below is the result I am getting when I use the below code

ZD outgoing :

Jira Incoming:

Result

Date in Zendesk selected is “June 16, 2023”

DateTime in JIRA showing is “Jun 15, 2023, 5:00 PM”

After this, I use the below code in Jira Incoming sync from one of the posts in the community

Link to the post

Using this I am getting below error.


Answer by Mathieu Lepoutre on 26 June 2023

Hi Shaleen Kukreti

Please put this in the incoming sync of Jira. For this example I added 5 hours, but you can just change that depending on your situation.

Incoming Jira Cloud Sync

import java.text.SimpleDateFormat
import java.util.Calendar

def dateString = "${replica.customFields."DateField".value}"
def inputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S")
def date = inputFormat.parse(dateString)


//hardcode 5 hours 
def timestamp = date.time
Calendar calendar = Calendar.getInstance()
calendar.timeInMillis = timestamp
calendar.add(Calendar.HOUR_OF_DAY, 5)
def updatedTimestamp = calendar.timeInMillis

issue.customFields."DateTime Field".value = updatedTimestamp

Thank you.

Kind regards,
Mathieu Lepoutre


Answer by Shaleen Kukreti on 16 June 2023

Hi Syed Majid Hassan any thoughts how to handle this ?


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.