Zendesk - Brand

Originally asked by Jillani Fazal on 19 June 2023 (original question)


I have couple of questions.

I was able to get the Brand solution working, I just had to adjust the last line of code as brand_id was a double for some reason.

replica."brand_id" = brand_id.toFloat().toInteger().toString()

Would it be possible to add firstSync to Zendesk outgoing? Would only like to send brand_id of the first sync.

I only want it outgoing on first sync to avoid a call to be made on every synchronization, though I can live with this if not possible.

----------------------------------------------

replica.addedAttachments.collect

{it.internal = true; it}

worked wonderfully, attachments are only added as internal notes in Zendesk, thanks.

However, attachments added as internal notes in Jira are still sent to Zendesk and added as internal notes in Zendesk. I tried to update Jira outgoing as follows as I have with comments, but it did not have any effect. How can I only send attachments added in internal notes from Jira to Zendesk?

replica.attachments = issue.attachments.findAll{!it.internal)

-------------------------------------------------

For the following line of code where “Contact reasons” is a custom drop-down field.

issue.customFields."Contact reasons".value = "account_closure"

How can we set value for custom drop-down fields in Zendesk?

I would appreciate if the following questions are addressed. Thank you!

(Asked on behalf of the client)


Answer by Support on 26 October 2023

Hello, Account Management , might I ask you to replace the getPreviousJson function with this

def getPreviousJson = {
    def ttRepo = (syncHelper).twinTraceRepository
    def await = { f -> scala.concurrent.Await$.MODULE$.result(f, scala.concurrent.duration.Duration.apply(1, java.util.concurrent.TimeUnit.MINUTES)) }
    def orNull = { opt -> opt.isEmpty() ? null : opt.get() }
    def ttOptFuture = ttRepo.getTwinTraceByLocalIssueKeyFuture(connection, issueKey)
    def ttOpt = await(ttOptFuture)
    def tt = orNull(ttOpt)
//com.exalate.api.domain.twintrace.ITwinTrace tt = orNull(ttOpt)
    def lr = tt?.localReplica
    !lr ? null : ({
        def js = new groovy.json.JsonSlurper()
        def previousPayload = js.parseText(lr.payload)
        previousPayload.hubIssue
    })()
}

Please, let me know how it goes


Answer by Account Management on 31 July 2023

Hi Serhiy,

Thanks for the workaround.

I am getting the following error when trying to use the workaround.

Please see screenshot attached.

Please let us know how to fix this.

Thanks,

BR,

Svein Tvedt

No such property: twinTraceRepository for class: zendesknode.services.node.hubobjects.NodeHelper 


Comments:

Serhiy Onyshchenko commented on 09 August 2023

Might I ask you to change the script a bit:

def getPreviousJson = {
    def ttRepo = (syncHelper).twinTraceRepository
//    com.exalate.persistence.twintrace.TwinTraceRepository ttRepo = ((com.exalate.replication.services.processor.SyncHelper)syncHelper).twinTraceRepository
    def tt = ttRepo.getTwinTraceByLocalIssueKey(connection, issueKey)
//com.exalate.api.domain.twintrace.ITwinTrace tt = orNull(ttOpt)
    def lr = tt?.localReplica
    !lr ? null : ({
        def js = new groovy.json.JsonSlurper()
        def previousPayload = js.parseText(lr.payload)
        previousPayload.hubIssue
    })()
}

def previousReplica = getPreviousJson()
def firstSync = (previousReplica == null)

Note, how nodeHelper.twinTraceRepository is replaced by (syncHelper).twinTraceRepository

Account Management commented on 10 August 2023

Thanks Serhiy Onyshchenko

I do not have that error anymore, now I have new error with the this workaround.

The following line produced the following error as per screenshot attached. Checked line by line to find out that the issue is with this line. Can you please check it out?

def tt = ttRepo.getTwinTraceByLocalIssueKey(connection, issueKey)

Jillani Fazal commented on 11 August 2023

Hi Account Management

It seems that the twintrace is missing for this local issue key; hence I would suggest you unexalate and then re-exalate to see if that makes any difference or not. Let me know the outcome.

BR,
Jillani

Account Management commented on 24 October 2023

Hi Jillani Fazal and Serhiy Onyshchenko ,

Unexalate an reexalate did not make a difference.

What do I need to do?

Thanks,

BR,
Svein Tvedt

Account Management commented on 26 October 2023

Hi Support ,

This function works perfectly, and now I am able to call Zendesk brand id on firstSync when it is the only time it is required.

Thank you very much (old community)

BR,

Svein Tvedt

Jillani Fazal commented on 31 October 2023

Account Management

Sounds great and you are most welcome. (old community)

Answer by Account Management on 07 August 2023

bumping thread


Answer by Serhiy Onyshchenko on 31 July 2023

UPDATED on Aug 9th due to feedback: Zendesk - Brand (old community)
Hello, Account Management ,

Thanks a lot for asking this in community!
I’ve got a work-around which may break in the future (since it relies on some private APIs) However the chances of this happening anytime soon are slim, since it has been working for the past 4 years:

def getPreviousJson = {
    def ttRepo = (syncHelper).twinTraceRepository
//    com.exalate.persistence.twintrace.TwinTraceRepository ttRepo = ((com.exalate.replication.services.processor.SyncHelper)nodeHelper).twinTraceRepository
    def tt = ttRepo.getTwinTraceByLocalIssueKey(connection, issueKey)
//com.exalate.api.domain.twintrace.ITwinTrace tt = orNull(ttOpt)
    def lr = tt?.localReplica
    !lr ? null : ({
        def js = new groovy.json.JsonSlurper()
        def previousPayload = js.parseText(lr.payload)
        previousPayload.hubIssue
    })()
}

def previousReplica = getPreviousJson()
def firstSync = (previousReplica == null)

Happy Exalating!


Answer by Jillani Fazal on 31 July 2023

Hi Account Management

Please try this in order to send the attachments in Zendesk as internal:

Attachment in internal Zendesk comment ? (old community)

For setting a value, please check this:

How to fill a default value for custom field in Zendesk…? (old community)…


Answer by Account Management on 31 July 2023

bumping thread


Answer by Account Management on 24 July 2023

bumping thread


Answer by Account Management on 17 July 2023

bumping thread


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