Hi Team,
I have a requirement where I need to sync tickets created from JSM project to Jira software project based on Request type selection in JSM project and set the particular issue type in software project.
f (firstSync && replica.project.key == “BFGS”) {
def customerImpact = replica.customFields.“Customer Impact”?.value?.value
def requesttype = replica.customFields.“Request Type”?.value?.value
def projectNameIdentifier = replica.customFields.“Project”.value.toString()
if (projectNameIdentifier) {
def project = nodeHelper.getProjectByName(projectNameIdentifier)
if (project) {
issue.projectKey = project.key
}
}
if (requesttype == “Request for Customer Training”){
issue.typeName = “Customer Training”
}
else if (requesttype == “Request for Onsite Support”){
issue.typeName = “Onsite Support”
}
I tried the above script but it says issue type not set. Let me know if there’s any other way to achieve this
After reviewing your script, I believe the issue is caused by the conditions not matching due to how the script is accessing the “Request Type” custom field.
In the structure of the “Request Type” field, the actual value you’re trying to compare—requestTypeName—is nested within a value object. The original line of code wasn’t accessing this field correctly, which caused the condition to fail and prevented the issue type from being set.
To resolve this, I recommend updating the line of script to the following:
This change ensures that the script correctly accesses the requestTypeName field inside the value object, allowing the conditions to match and the issue type to be set properly.
Please try this update and let us know if it resolves the issue. We’re happy to assist further if needed!