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
We are trying to sync an issue type of Change in Jira Software with a Change request in ServiceNow. When looking at the field in ServiceNow I see that the column name is type and the choices (values) are standard, normal and emergency. This is a standard (not custom) field in ServiceNow but it seems that I can't sync to or from this field. Both fields are Select Lists.
Here is the setup:
Jira Outgoing sync
replica.customFields."Change Type" = issue.customFields."Change Type"
ServiceNow Incoming sync
def changeTypeMap = [
"Normal" : "normal",
"Emergency" : "emergency",
"Standard" : "standard"
]
def remoteChangeType = replica.customFields."Change Type"?.value?.value
entity.type = (changeTypeMap[remoteChangeType]?: remoteChangeType)
To check the data:
debug.info("replica.customFields.'Change Type'?.value?.value = ${replica.customFields.'Change Type'?.value?.value}")
Results:
replica.customFields.'Change Type'?.value?.value = Normal
debug.info("remoteChangeType = ${remoteChangeType}")
Results:
remoteChangeType = Normal
debug.info("ChangeTypeMap is ${changeTypeMap[remoteChangeType]}")
Results:
ChangeTypeMap is normal
entity.type = (changeTypeMap[remoteChangeType]?: remoteChangeType)
Results:
Cannot cast object 'normal' with class 'java.lang.String' to class 'com.exalate.api.domain.hubobject.v1_2.IHubIssueType'
Jira Payload
ServiceNow Payload
because it has not been created yet.
Edited
entity.type = (changeTypeMap[remoteChangeType]?: remoteChangeType)
To
entity.type?.value = (changeTypeMap[remoteChangeType]?: remoteChangeType)
debug.info("entity.type?.value is ${entity.type?.value}")
Result:
entity.type?.value is null
Edited
entity.type?.value = (changeTypeMap[remoteChangeType]?: remoteChangeType)
To
entity.type?.name = (changeTypeMap[remoteChangeType]?: remoteChangeType)
debug.info("entity.type?.name is ${entity.type?.name}")
Result
entity.type?.name is null
Edited
entity.type?.name = (changeTypeMap[remoteChangeType]?: remoteChangeType)
To
entity.type?.value?.name = changeTypeMap[remoteChangeType]?: remoteChangeType
debug.info("entity.type?.value?.name is ${entity.type?.value?.name }")
Result
entity.type?.value?.name is null
These values are null but the Change IS created in ServiceNow as a Normal change since it is the default type.
However when syncing back to Jira, we get an error:
Could not update issue `183,920`: Field customfield_10112: Specify a valid 'id' or 'name' for Change Type. Check the documentation for more details.
The issue and the field exist.
ServiceNow Outgoing sync
replica.type = entity.type
Jira Incoming sync
def typeMap = [
// ["remote options" : "local option"]
"normal" : "Normal",
"emergency" : "Emergency",
"standard" : "Standard"
]
def remoteChangetype = replica.type
issue.customFields."Change Type"?.value?.value = typeMap[remoteChangetype]?: remoteChangetype
debug.info(("remoteChangetype is ${remoteChangetype}"))
Result
remoteChangetype is null
ServiceNow payload – does not include any “type” field at all.
Edited
def remoteChangetype = replica.type
To
def remoteChangetype = replica.type?.value.?name
debug.info(("remoteChangetype is ${remoteChangetype}"))
Result
remoteChangetype is null
So it seems that ServiceNow is not sending entity.type data or it is not the right field.
To test that, I created an Emergency Change in ServiceNow to sync over to Jira.
ServiceNow Outgoing sync
replica.type = entity.type
Jira Incoming sync
def typeMap = [
// ["remote options" : "local option"]
"normal" : "Normal",
"emergency" : "Emergency",
"standard" : "Standard"
]
def remoteChangetype = replica.type?.name
issue.customFields."Change Type"?.value?.value = typeMap[remoteChangetype]?: remoteChangetype
ServiceNow payload
Where is issueType coming from?
Jira Payload
This created a Normal Change in Jira and that Normal type synced back to ServiceNow somehow.
Updated the ServiceNow Outgoing sync to
replica.type = entity.issueType
Same result.
What am I missing here? I have tried more than what I have entered here but am running out of ideas.