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.

Introduction


You use Exalate to integrate Salesforce with Jira Cloud.

...

However, it is important to note that the prerequisite for this integration is that the email address of the user must be identical in both the Salesforce and Jira Cloud instances.
This requirement establishes a reliable connection point for Exalate to match and synchronize the data effectively.



The code

Outgoing Sync Salesforce


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 
 comment 
def the_id_variable = entity.Id

def res = httpClient.get("/services/data/v54.0/query?q=SELECT+CommentBody%2CBody%2C+CreatedById%2C+CreatedBy.Email+FROM+CaseCommentCaseFeed+WHERE+ParentId=%27${the_id_variable}%27+ORDER+BY+CreatedDate+DESC+LIMIT+1")

replica.res = res
}

...





Code Block
collapse
languagegroovy
titleIncoming Sync Jira Cloud
linenumberstruetrue
if (firstSync) {
    issue.projectKey   = "MAT"
    // Set the same issue type as the source issue. If not found, set a default.
    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 }))

...


}













Questions

Questions List
filterrecent
asktrue
include-topicsany
spaceexacom

...