Originally asked by Mikael Bohlin on 24 November 2020 (original question)
Hi,
whats the easist way to add an internal comment on outgoing sync with date and time ?
Originally asked by Mikael Bohlin on 24 November 2020 (original question)
Hi,
whats the easist way to add an internal comment on outgoing sync with date and time ?
Answer by Mikael Bohlin on 01 December 2020
Hi,
so the steps to set it up is:
if (firstSync) {
syncHelper.syncBackAfterProcessing()
}
2. Add the custom field Sync Date of type Date
3. Add the follwoing to our incomming sync ?
if (issue.customFields."Sync Date" == null) {
issue.customFields."Sync Date".value = new Date()
}
Step 3, would that not just update first sync date ?
Regards
Mikael B
How do you mean
> Step 3, would that not just update first sync date ?
What will happen.
The custom field will contain the date that the sync has been confirmed
Answer by Francis Martens (Exalate) on 24 November 2020
Hi Mikael Bohlin
Francis
Hi,
outgoing sync from Zendesk to JIRA. We would like it to be added as an internal comment in Zendesk only.
Hi,
date and time should be the date and time when the outgoing sync is started.
Regards
Mikael B
> outgoing sync from Zendesk to JIRA. We would like it to be added as an internal comment in Zendesk only.
So - JIra comments need to be added as internal comment to zendesk
> date and time should be the date and time when the outgoing sync is started.
Would the date and time of when the comment was added to the Jira be ok?
Hi,
if the comment and date is the date when it was synced with JIRA. This is for getting a timestamp in Zendesk to be able to track when the sync is initiated.
Regarding the time when the sync is initiated …
Add following to the replica
Outgoing
replica.customKeys."Sync date" = new Date()
This then can be used in the incoming to update a date (or add to the comment)
Incoming
// add a custom field of type date
issue.customFields."Sync Date".value = replica.customKeys."Sync date"
Hi,
i just want to add an internal comment in (In Zendesk) to the ticket that is synced . The comment should contain:
Ticket sync initiatet: “Date and Time”
OK?
Regards
Mikael
Hi,
can i write something like this in the outgoing syncrule:
issue.addedComments = replica.addedComments.collect{ c →
def Syncdate = newDate()
c.body = “Synk started:”+Syncdate
c
}
issue.comments = commentHelper.mergeComments(issue, replica, {it.internal = true})
Hi,
can i do like this ?: Will this work ?
1) Create a custom field in Zendesk “Sync Date”
2) Add the following to the outgoing sync script:
issue.customFields."Sync Date".value= newDate()
Hi Mikael Bohlin
You can’t set the issue/ticket on the outgoing sync because this could create loops.
What you can do is to add a syncBackAfterprocessing in the incoming sync on Jira.
So
Incoming Sync - Jira
if (firstSync) {
syncHelper.syncBackAfterProcessing()
}
on Zendesk, incoming sync, assume there is a custom field - Sync Date
Incoming Sync - Zendesk - Untested
if (issue.customFields."Sync Date" == null) {
issue.customFields."Sync Date".value = new Date()
}
Hope this helps
Will this work for multiple updates ? That is if a ticket is synced serveral times ?
Yes, that is why there is the if statement.
Once that it has been updated, it will remain.
If you would like to have the sync date updated each time that the sync happened, just remove the if statement
Ok,
but we want to use this for monitoring the last sync date. I guess we can remove the "first sync condition ?
Yes - I assumed the requirement was ‘first sync’