SF to JIRA sync script need proper case number mapping

Originally asked by Support on 10 March 2023 (original question)


Hello,

We need to map actual SalesForce case number (like 05934910) to a custom field on Jira side, right now we are getting a value like this: 500Di00000R0auZIAR

Current SF mapping is like this for the field

SF Outgoing sync

if(entity.entityType == "Case") {
  replica.key            = entity.Id
  replica.summary        = entity.Subject
  replica.description    = entity.Description
  ....
}

Jira incoming sync

else if (issue.projectKey == "NUM"){issue.customFields."SalesForce Case Number".value = replica.key}


We would like to have the proper field that needs to be sent from SF to have the actual case number instead of the long string we are currently getting.


Comments:

Ariel Aguilar commented on 10 March 2023

Try

SF Outgoing sync

if(entity.entityType == "Case") {
  replica.key            = entity.Id
  replica.summary        = entity.Subject
  replica.description    = entity.Description
  replica.number         = entity.CaseNumber
}

Jira incoming sync

else if (issue.projectKey == "NUM"){
issue.customFields."SalesForce Case Number".value = replica.number
}


Kind regards,

Ariel