Why does a custom field not update in zendesk when updating it using a workflow screen

Annastashia Cambridge December 11, 2012

Hi, I've got Jira and Zendesk integrated and have several custom fields mapped between the two systems. I've noticed that when I update a custom field on 'x' screen during a workflow transition that the value is not synchronized through to Zendesk (other non custom fields do sync). The custom field does however successfully synchronize when the update is made on the view screen or edit ticket screen.

Any ideas? Solutions?

Thanks, Stash

3 answers

1 accepted

2 votes
Answer accepted
Luke Garner December 11, 2012

Hi Stash,

My organisation had fallen a victim of the the same problem - Cloud Diagnostics logs indicate theat whenever there is any user input in the transition screen, the plugin tranmits old value of the custom field to Zendesk as opposed to the new one. New value is sent correctly when no data has been input in the transition screen.

While the plugin itself is supplied by CustomWare, it's Zendesk that actually supports it. I have reported this problem to Zendesk at the beginning of November but haven't heard back about any solution or workaround being available.

Expecting things to go that way (I imagine there are many layers such a request has to go through until it reaches developers actually working on the plugin - especially when they are from a separate company) I resorted to writing custom replacement for this bit of functionality: transitions' post-functions update custom field in Jira and generate custom events; custom event listener in Jira reacts to those events and updates Zendesk with custom field's value.

I hope this helps,

Rafal

Annastashia Cambridge January 19, 2013

Thanks, yes I've taken this through Zendesk. It is that the event's aren't being captured when fired by the plug-in.

Elisa Menegatti March 4, 2013

Hi Rafal, can u explain more the solution that you have applied to solve that issue? i'm trying to replicate it.

Luke Garner March 7, 2013

(comment part 2/2)

Therefore, in order to obtain the details of changes, plugin:

A) obtains id of current change group,

B) iterates through ALL changes in the history of current issue and picks out only those changes whose 'change group id' matches the one referenced by current issue event.

Change group id can be obtained from a map (object of type GenericValue) returned by methodIssueEvent.getChangeLog(); it's associated with the key "id".

Changes in the history of an issue can be retrieved by callingChangeHistoryManager.getAllChangeItems( issue ) method.

Note that updates to comments seem to be handled somewhat different so the above is unlikely to work for them.

I hope this helps.

Regards,

Rafal

Luke Garner March 7, 2013

(comment part 1/2)

Hi Elisa,

Zendesk support came back to me a couple of weeks ago saying that the issue has (likely) been fixed in the latest version of the plugin. While I wasn't able to test it myself, you may want to check it out and see for yourself if the problem persists.

The key bit of my workaround is a custom event listener plugin which reacts to all issue events. Plugin holds a list of Jira fields that it monitors, mapped to corresponding Zendesk fields that need to be updated with values from Jira. When it receives an issue event (and it finds out that the issue is connected to a Zendesk ticket) it obtains from Jira a set of changes (change log) associated with the event and scans it for changes that affected any of the monitored fields. From all those matching changes it extracts the new values and, using Zendesk REST API, it updates mapped fields in Zendesk.

The most tricky part was to extract the right changes, i.e. objects of type ChangeHistoryItem which contain ids of affected fields and the fields' old and new values:

Changes associated with current issue event share the same 'change group id'. It appears that instead of referencing individual changes, event object only contains id of a 'change group', i.e. of a set of changes generated by/in association with given event (e.g. a user may update several fields in the transition window before 'committing' the transition; all updates to those fields would be aggregated in a single change group).

0 votes
Annastashia Cambridge March 4, 2013

HI Elisa, I saw your comment and remembered I needed to update this post further. I figured out what was wrong and now have it working perfectly. I discovered that if you are only using a 'generic event' on your workflow transition then, any custom fields you have on that screen won't be synchronized with Zendesk. You need to use another event, like issue updated or issue assigned for example.

Let me know if you need any help, I've had to become an expert with the integration to get it all to work to meet our needs.

Cheers, Stash

Fabrizio Galletti
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 5, 2013

hi, i'm a coworker of elisa and i'm studing tthis solution, thanks for your advice.

now i'm trying to figure out how to sync the status because zd isn't trigger any customlistener (like groovy or toolkit)

Annastashia Cambridge March 5, 2013

Hi Fabrizio, where are you trying to sync the status? from a workflow or other? The status in JIRA and Zendesk with the integration, by default just sync for the values open and solved, which is a pain because it means that JIRA will 'solve' Zendesk tickets when a JIRA ticket is resolved. We don't want this to happen in our workflow, so I've used a custom field in JIRA and mapped bidirectionally, the Zendesk status field to this so that we can control it correctly. I've implemented some other fields and triggers as well to get our desired behavior between the two systems.

I can help further if you like, let me know what you are trying to achieve.

Fabrizio Galletti
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 6, 2013

Ah ok, i know that jira status is readonly, so i've another field status that i sync with ZD.

I was interested in trigger that u have implemented. How can this be done? When ZD add a comment or update a field he doesn't arise custom listener but only the standard commented and updated issue listener.

0 votes
Luzia Mendes
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 11, 2012

I guess you need to contact Zendesk for that. See, JIRA is not responsible for Zendesk's behavior, neither Atlassian knows how Zendesk built the plugin that integrates both applications.

Maybe there is a bug in JIRA's code, but Zendesk will have to investigate and report that.

The Zendesk plugin should monitor JIRA's behavior and push changes into Zendesk...if it's failing, it's the plugin's fault.

Suggest an answer

Log in or Sign up to answer