Introduction
You use Exalate to integrate Salesforce with Jira Cloud.
In this tutorial, we will delve into the script mode of Exalate to demonstrate how comments from Salesforce can be integrated and displayed in Jira Cloud in a personalized manner.
One key aspect to consider is that Salesforce utilizes unique user and account identifiers, commonly known as IDs. To ensure accurate integration, we will employ Salesforce Query Language (SoQL) to retrieve the associated email address for a particular user.
Moving on to Jira Cloud, we will modify the proxy user based on the retrieved email address. This crucial step ensures that the comment in Jira Cloud is attributed to the corresponding user who originally created it in Salesforce. By dynamically assigning the comment creator, the integration becomes more seamless and representative of the original contributors.
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
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 }
Incoming Sync Jira Cloud
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 }))
Video
Questions
Recent Questions
- 0votes
- 0votes
- 0votes
- 0votes
- 0votes
- 0votes
- 0votes
- 0votes
- 0votes
- 1vote