Hello, good evening. Could you help me with this request? A client has asked us to create a solution in Scriptrunner that prevents members of their team from accidentally choosing issue types that do not correspond when creating a linked incident from its parent incident. Basically, they want this automation to overwrite or force that value and assign the issue type value of the parent issue from which the linked issue was created, regardless of the type of incident chosen when creating a linked incident on the creation screen.
Requirements:
Request Type = SAP Incidents
Issue Type = Incident
This automation should only be triggered when a parent issue is created whose issue type is “Incident” and its request type is “SAP Incident.” It does not apply to all other request types. So, once this parent issue has been created and someone decides to create a linked issue, if they select the issue type “Incident” on the creation screen, there is no problem; the automation is not triggered because the correct issue type is chosen, since the aim is for both the parent and the child to have the same issue type. However, if another issue type is chosen by mistake (e.g., request), then the automation is triggered and forces that incorrect value, overwriting it and assigning the issue type value of the parent issue, which is “Incident.”
I created this code in ScriptRunner (I'm not an expert) and I know a little bit about programming. I understand that the logic is very close to being functional because it is doing the PUT for me, but it is giving me a 204 error, and I can't find the error or logic that is not bringing me the issue type value of the parent issue and forcing the issue type value of the linked issue. I'm stuck there. Maybe you can help me a little with this logic or this error.
Things to keep in mind:
- Issue types work with different workflows.
- I checked the access permissions and we have all of them (roles and groups), but somehow I can't even manually change the issue type of an issue that's already been created, and I don't know why, since I've verified that we have the permissions.
- There are no validations or conditions in the workflows that cause conflict with this automation.