1
0
-1
1 answer
- 10-1
Hi Sandra Campbell,
Using the following in the Zendesk outgoing script should suffice:
def res = httpClient.get("/api/v2/tickets/${issue.key}.json") def created_at = res.ticket.created_at debug.error("${created_at}")
but you need to be careful about the format you receive it on the destination end. You might need to manipulate it a little (not sure as I have not tested it end to end).
Hope it helps.
Thanks
Majid
- Sandra Campbell
that got me the required date info, and yes it does need some manipulation to get it into the right format,
appreciate your help
thanks,
Sandra
- Sandra Campbell
This is what ended up working ...
Zendesk outgoing script
def res = httpClient.get("/api/v2/tickets/${issue.key}.json") def inputDate = res.ticket.created_at replica."Date created" = inputDate
Jira On Prem incoming script
import java.time.Instant import java.time.LocalDateTime import java.time.ZoneOffset import java.time.format.DateTimeFormatter def inputDate = replica."Date created" def formatter = DateTimeFormatter.ISO_INSTANT def instant = Instant.from(formatter.parse(inputDate)) def epochTimestamp = instant.toEpochMilli() issue.customFields."ZD Created date".value = epochTimestamp
- Syed Majid Hassan
Awesome! Ye I feared that date formatting thing.
Glad to see it work.
Thanks for sharing
Add your comment...
I need to get the the Zendesk ticket created date and populate to a custom date field in Jira On Prem.
However the issue.created value does not seem to work in Zendesk. The Exalate doco (How to Sync CreatedDate Field? | Exalate Documentation) doesn't show Zendesk in the list of system labels at the top of the screen. But I tried it anyway.
When I put this in the Zendesk outgoing script:
I get this error message:
Am I doing something wrong? Or is there another way/command to get the date a Zendesk ticket is created?
thanks, Sandra