Salesforce <-> Jira - Sync Case with nested Cases

I think there are 2 ways of doing this:

  1. Use automation within Salesforce to maybe populate a custom field on the parent case that is populated with a list of whatever values you need from the child cases (you can even create a correlation if you use 2 fields - 1 to hold the case number, and another to hold the actual value of the field, and both are comma separated list). Then, Exalte picks up the contents of these fields, and transports them to the remote side.

  2. Use Exalate scripts to do everything. This is a more complex approach for sure, but I will describe it briefly here:

Steps to use Approach 2:

  • Work out what cases are children of the case being Exalated. You can use SOQL to achieve this e.g. the query SELECT casenumber, id, mood__c FROM Case WHERE parentid='500J700000BYdetIAD' gives me a list of IDs and the values of the field Mood__c on all test cases.
  • Create a httpClient request in Exalate outgoing script. I used:
def res = httpClient.get("/services/data/v54.0/query/?q=SELECT+Mood__c+from+Case+where+ParentId=%27${replica.key}%27").records.Mood__c
replica.Mood__c = res

As a result of this, I am able to fetch the values of all Mood fields on all child cases.

  • The receiving side now receives the following in the payload (in my case of 2 child objects):

  • The last piece would be to iterate the array and put it anywhere you want e.g. I put it in the Jira description field (can be done simpler I am sure):

def i = 0, temp = ""
issue.description  = replica.Mood__c.collect {
  temp += "Value " + i + ": " + it + "\n"
  i++
  temp
}
issue.description = replica.description + "\n\n" + "${temp}"

Hope it helps!

Thanks
Majid