Originally asked by Logan Hawkes on 16 November 2022 (original question)
I have a Jira Service Manager project (MJ) linked to sync issues to a normal Jira project (CARS). I am trying to sync and display the value of the Customer Request Type field in the normal project. I can sync the values, but the value in the normal project is displayed as blank.
If I search for issues where Customer Request Type is populated I can see that the value is getting synced. In this example MJ-213 is created in the JSM project and exalated to create the issue CARS-2428:
project in (MJ, CAPPS) AND "Customer Request Type" is not EMPTY ORDER BY created DESC
Result:
Key | Summary | Customer Request Type | Notes: |
---|---|---|---|
CARS-2428 | Nov 16 1247 New Confluence account to CARS | Linked to MJ-213 | |
MJ-213 | Nov 16 1247 New Confluence account to CARS | Request a new account | Linked to CARS-2428 |
I checked the screens and the field configurations, and the Customer Request Type is available to both. When I do a “Where is my field?” on CARS-2428 post-sync, Jira reports that the field is available and populated.
The Jira version is 8.20 Datacenter (on-prem), JSM is v4.20, and Exalate is v5.3.9-j8 (latest).
I don’t see anything in the logs to indicate an error.
Is it just that since Customer Request Type is a Jira Service Manager field the value won’t appear in a normal Jira project?
// Sync custom field "Customer Request Type"
// Two-way sync
// Note: executionInstanceName is where the data will be synced TO
// Note: the value of "Customer Request Type" will not display in the linked Jira issue despite it being available and populated.
// Customer Request Type may be referred to as "Request Type" depending on the JSM version. Grrr..
log.debug("Syncing Customer Request Type")
sourceProject = MJ
destinationProject = CARS
if (sourceProject.issue.customFields."Customer Request Type") {
log.debug("sourceProject.customFields.Customer Request Type is populated / accessible")
log.debug("sourceProject.issue.customFields.Customer Request Type: " + sourceProject.issue.customFields."Customer Request Type".value)
}
else {
log.debug("sourceProject.customFields.Customer Request Type is not populated or is not accessible")
}
if (executionInstanceName == "MJ") { // CARS -> MJ
log.debug("Syncing from CARS to MJ because executionInstanceName = " + executionInstanceName)
try {
MJ.issue.customFields."Customer Request Type" = CARS.issue.customFields."Customer Request Type"
} catch (Exception E) {
log.error("Caught exception when copying CARS.issue.customFields.Customer Request Type to MJ " + E.getMessage())
}
}
else if (executionInstanceName == "CARS") { // MJ -> CARS
log.debug("Syncing from MJ to CARS because executionInstanceName = " + executionInstanceName)
try {
CARS.issue.customFields."Customer Request Type" = MJ.issue.customFields."Customer Request Type"
} catch (Exception F) {
log.error("Caught exception when copying MJ.issue.customFields.Customer Request Type to CARS " + F.getMessage())
}
}
else {
log.error("Can't work out executionInstanceName: " + executionInstanceName)
}
log.debug("Done syncing Customer Request Type")
Edit: Added code for sync
Comments:
Harold Oconitrillo commented on 17 November 2022
Hi,
May you please add to this post not only the incoming, but also the outgoing script you’re using for this configuration?
Kind regards,
Harold Oconitrillo
Logan Hawkes commented on 17 November 2022
Added above. Thanks!