Having some trouble with Script Fragments in Jira Software 8.1.0. and Adaptavist ScriptRunner 5.5.6.1-jira8.
GOAL
One of my projects contains a unique Issue Type called AWS Migrations. We create a parent issue and six sub-tasks underneath it for each software environment (QA, Pre-Prod, Practice, Production, and Demo).
I want to replace the Clone button with multiple scripts to Clone to P_PRE, Clone to P_PS, Clone to P_PRD, and Clone to P_DEM. This will allow me to create a custom clone script that also edits certain values in the master ticket that are important for each environment.
PROBLEM
My first script fragment should hide the Clone option from the More dropdown, but only if the Issue Type is AWS Migrations. I added the following condition and it works fine.
! (issue.issueType.name == "AWS Migration")
My next script fragment is to add a new option Clone to P_PRE to the More dropdown. Since this should only be available if Issue Type is AWS Migrations, I figured this should work.
issue.issueType.name == "AWS Migration"
Instead, I get the following checking error:
[Static type checking] - The variable [issue] is undeclared.
@ line 1, column 1.
QUESTION
Why is this happening? What is the correct syntax for the condition?
With the help of script runner support-
I manage to send the email to a different user:
def resp = post("/rest/api/2/issue/${issueKey}/notify")
.header("Content-Type", "application/json")
.body([
subject: 'Service desk automation success!',
textBody: "Service desk ticket created with script runner automation.",
htmlBody: "<p>Service desk ticket created with script runner automation.</p>",
to: [
//users: [[
/// name: "neta.elyakim",
// active: true
//]]
groups: [[
name: 'some group'
]]
]
])
.asString()
but when I tried to send the request with different user auth (not my auth - different user and to send it to myself) it's didn't work.
In order to send the post request with someone else auth it needs to be done like this:
https://stackoverflow.com/questions/25692515/groovy-built-in-rest-http-client#42664926
Bug with the notify rest:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.