Note

We've packed up and moved from Confluence to Discourse to bring you a better, more interactive space. Out of courtesy we didn't migrate your user account so - you will have to signup again

The Exalate team will be on holiday for the coming days - returning Jan 4
Enjoy & stay safe

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagegroovy
titleOutgoing Sync Salesforce
linenumberstrue
collapsetrue
if(entity.entityType == "Case") {
replica.key            = entity.Id
replica.summary        = entity.Subject
replica.description    = entity.Description
replica.comments       = entity.comments
replica.attachments    = entity.attachments
replica.Status         = entity.Status


//Retrieving the email from the last comment 
def the_id_variable = entity.Id
def res = httpClient.get("/services/data/v54.0/query?q=SELECT+CommentBody%2C+CreatedById%2C+CreatedBy.Email+FROM+CaseComment+WHERE+ParentId=%27${the_id_variable}%27+ORDER+BY+CreatedDate+DESC+LIMIT+1")
replica.res = res
}

...

Code Block
languagegroovy
titleIncoming Sync Jira Cloud
linenumberstruecollapsetrue
if(firstSync){
   issue.projectKey   = "MAT" 
   issue.typeName     = nodeHelper.getIssueType(replica.type?.name, issue.projectKey)?.name ?: "Task"
}
issue.summary      = replica.summary
issue.description  = replica.description
issue.attachments  = attachmentHelper.mergeAttachments(issue, replica)
issue.labels       = replica.labels


//Impersonating the comment with the right user

def uid = replica.res.records[0].CreatedById
def uid_comments = []

replica.comments.each {
    if(uid == it.author.key) {
        uid_comments.push(it)
    }
}
def latest_message = uid_comments.sort { it.created }[-1].body

replica.addedComments.each { it.executor = nodeHelper.getUserByEmail("${replica.res.records[0].CreatedBy.Email}") }
issue.comments = nodeHelper.toMarkDownComments(commentHelper.mergeComments(issue, replica, { it }))

...