# Sync "Submitter" in Zendesk to JIRA Reporter

**URL:** <https://community.exalate.com/t/sync-submitter-in-zendesk-to-jira-reporter/4405>\
**Category:** General Questions\
**Tags:** onpremise-jira, exalate, cloud-zendesk, migrated\_question\
**Created:** [November 4, 2024, 6:54am UTC](https://community.exalate.com/t/sync-submitter-in-zendesk-to-jira-reporter/4405 "2024-11-04T06:54:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 6:54am UTC](https://community.exalate.com/t/sync-submitter-in-zendesk-to-jira-reporter/4405/1 "2024-11-04T06:54:39Z")

</div>

_Originally asked by Spencer Johnson on 21 October 2020 [(original question)](https://oldcommunity.exalate.com/questions/20120405)_

* * *

Hi I am trying to sync a hidden zendesk field “Submitter” it is a system field only accessible via the API but represents who actually created the ticket (see here for more details: [https://developer.zendesk.com/rest\_api/docs/support/tickets](https://developer.zendesk.com/rest_api/docs/support/tickets)) to the reporter in JIRA. However, it looks like that field is not accessible via exalate.

The “Submitter” also creates the first comment on the zendesk ticket so I was trying to use that to set reporter by getting the author of the first comment but was struggling with that as well and it was not working:

Zendesk Outgoing:

```auto
replica.comments = issue.comments

```

JIRA Incoming:

```auto
if(firstSync){
issue.projectKey = "NOC"
// Set type name from source issue, if not found set a default
issue.typeName = "Incident"
def reporter = null
issue.comments = commentHelper.mergeComments(issue, replica)

{ reporter = it.author?.email it.executor = nodeHelper.getUserByEmail(it.author?.email) }

if (reporter != null)

{ issue.reporter = userHelper.getByEmail(reporter) }

}

```

* * *

---

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 6:54am UTC](https://community.exalate.com/t/sync-submitter-in-zendesk-to-jira-reporter/4405/2 "2024-11-04T06:54:40Z")

</div>

_Answer by Spencer Johnson on 23 October 2020_

Francis Martens (Exalate) thank you for all the help, I wanted to post the final solution that I got to work:

Zendesk Outgoing:

```auto
// Submitter of Ticket (ie Reporter)
def ticketDetails = httpClient.get("/api/v2/tickets/${issue.key}.json")
Long submitterId = ticketDetails["ticket"]["submitter_id"]
def userDetails = httpClient.get("/api/v2/users/${submitterId}.json")
replica.customKeys."Reporter Email" = userDetails.user.email

```

JIRA Incoming:

```auto
def reporterEmail = replica.customKeys."Reporter Email"
if (reporterEmail) {
    issue.reporter = userHelper.getByEmail(reporterEmail) ?: defaultUser
} 

```

* * *

#### Comments:

> **Francis Martens (Exalate) commented on 24 October 2020**
>
> > Awesome

---

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 6:54am UTC](https://community.exalate.com/t/sync-submitter-in-zendesk-to-jira-reporter/4405/3 "2024-11-04T06:54:41Z")

</div>

_Answer by Francis Martens (Exalate) on 22 October 2020_

Aparently an oversight in the Exalate API

A workaround can be based by using the httpclient

```auto
def ticketDetails = httpClient.get("/api/v2/tickets/${issue.key}.json")
Long submitterId = ticketDetails["ticket"]["submitter_id"]

def userDetails = httpClient.get("/api/v2/users/${submitterId}.json")
throw new Exception("Submitter = ${submitterId}, user = ${userDetails}")

```

Give it a try. I will raise some requests on our backlog…

* * *

#### Comments:

> **Spencer Johnson commented on 22 October 2020**
>
> > Francis Martens (Exalate) where should I put that? The error thrown from the exception displayed the userDetails properly but I am not sure how to send that to JIRA
> 
> This is what I tried but am getting an error on the zendesk side (Details: Cannot cast object):
> 
> Zendesk Outgoing:
> 
> ```auto
> // Submitter of Ticket (ie Reporter)
> def ticketDetails = httpClient.get("/api/v2/tickets/${issue.key}.json")
> Long submitterId = ticketDetails["ticket"]["submitter_id"]
> 
> def userDetails = httpClient.get("/api/v2/users/${submitterId}.json")
> //throw new Exception("Submitter = ${submitterId}, user = ${userDetails}")
> replica.reporter = userDetails
> 
> ```
> 
> JIRA Incoming:
> 
> ```auto
> if (replica.reporter != null){
> issue.reporter = userHelper.getByEmail(replica.reporter?.email)
> }
> 
> ```
> 
> I also tried this and didn’t get an error but the value isn’t there on the JIRA side:
> 
> Zendesk Outgoing:
> 
> ```auto
> // Submitter of Ticket (ie Reporter)
> def ticketDetails = httpClient.get("/api/v2/tickets/${issue.key}.json")
> Long submitterId = ticketDetails["ticket"]["submitter_id"]
> 
> def userDetails = httpClient.get("/api/v2/users/${submitterId}.json")
> //throw new Exception("Submitter = ${submitterId}, user = ${userDetails}")
> replica.customFields."Reporter Email" = userDetails.email // this is not an actual custom field name 
> 
> ```
> 
> JIRA Incoming:
> 
> ```auto
> def reporterEmail = replica.customFields."Reporter Email"?.value
> if (replica.customFields."Reporter Email"?.value != null){
> issue.reporter = userHelper.getByEmail(replica.customFields."Reporter Email".value)
> }
> 
> ```
> 
> I also tried to throw an exception with the value of reporterEmail on the JIRA side but it came back as null

> **Francis Martens (Exalate) commented on 23 October 2020**
>
> > Instead of
> 
> ```auto
> replica.customFields."Reporter Email" = userDetails.email // this is not an actual custom field name 
> 
> ```
> 
> You can use customKeys
> 
> **Outgoing Zendesk**
> 
> ```auto
> replica.customKeys."Reporter Email" = userDetails.email 
> 
> ```
> 
> And then on the receiving side
> 
> ```auto
> if (replica.customKeys."Reporter Email") {
> issue.reporter = userHelper.getByEmail(replica.customKeys."Reporter Email")
> }
> 
> ```

> **Spencer Johnson commented on 23 October 2020**
>
> > Thanks for the help Francis Martens (Exalate) I had to make a small tweak which I posted as answer but it is working now!

---

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 6, 2024, 6:55am UTC](https://community.exalate.com/t/sync-submitter-in-zendesk-to-jira-reporter/4405/4 "2024-11-06T06:55:31Z")

</div>

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