1 answer
- 210
Hi!
That code should be adding a comment for every sync zendesk received where the CF Test Field value is set (not only the update that set it). So probably that's not what you want. Still is possible to solve your use case with:
def testFieldV = replica.customFields."Test Field"?.value if(testFieldV){ if(firstSync || testFieldV != previous.customFields."Test Field"?.value) issue.comments = commentHelper.addComment(issue.comments){comment -> comment.internal = false comment.body = testFieldV } }
- Spencer Johnson
Juan Grases Thanks for the info! I tried what you suggested and its not adding a comment so I modified it to
def testFieldV = replica.customFields."Test Field"?.value if(testFieldV) { if(firstSync || testFieldV != previous.customFields."Test Field"?.value) { commentHelper.addComment(issue.comments){comment -> comment.internal = false comment.body = testFieldV } issue.customFields."Test Field".value = replica.customFields."Test Field".value } }
ie added a line to sync to the value to a custom field in Zendesk to see if both of the if statements are working (which they are since the value is synced to that custom field in zendesk. So it looks like the below line is the issue:
commentHelper.addComment(issue.comments){comment -> comment.internal = false comment.body = testFieldV }
And does not successfully add a comment to the ticket in Zendesk, Any ideas on how to fix that?
- Juan Grases
Hi! My bad, the code should be:
issue.comments = commentHelper.addComment(issue.comments){comment -> comment.internal = false comment.body = testFieldV }
I am editing my initial answer
- Spencer Johnson
Juan Grases that worked!!! Thank you so much!
Add your comment...
I want to sync a custom field in jira to public reply in zendesk, ie. any time custom field is editing a new public reply is created in zendesk. Note: I still want all other comments in JIRA to be added as internal notes in zendesk. The custom field in JIRA is called "External Notification"
Here is what I have so far and it is working to add internal comments in Zendesk but not public replies.
Zendesk Incoming Sync:
JIRA Outgoing Sync: