Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Scriptrunner for getting the current key on runtime in production environment

Kalyan Kumar Das
Contributor
January 6, 2020

The new JIRA has been installed and i am facing the issue in script-runner. I m searching for 4 days.

The two point is provided below which i need to fix:

1. I am unable to restrict for update the value of an issue at the time of issue update event. I had created a script on script listener.

2. Instead of hard coded value for key, i want to use dynamic code on script-runner. Means if the ticket is sub-task issue and project will be the same then the below script will execute.

Here the script is provided below and the requirement is duedate value for Task IssueType should be greater than the Duedate value for n number of subtask IssueType :

import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.Issue
import groovy.transform.BaseScript
import com.onresolve.scriptrunner.runner.customisers.ContextBaseScript
import com.onresolve.scriptrunner.runner.util.UserMessageUtil
import com.opensymphony.workflow.InvalidInputException

//

@BaseScript ContextBaseScript script

Issue issue = getIssueOrDefault("TEST-258") // Hard coded issue-key defined

if(issue.parentObject.dueDate.compareTo(issue.getDueDate()) >= 0)
{
UserMessageUtil.success("Due Date Success"+issue.dueDate)
log.debug(issue.getDueDate())
}
else
{
UserMessageUtil.success('Please enter the Subtask duedate that is less than Parent-Task Due-Date ')
//throw new InvalidInputException("Input not valid")
}

The problem is that when the condition fails then the date will be update first and next the pop up alert is raised which i mentioned in the code but I am unable to restrict the due date update. Also recommend us for second point on run-time environment(on production).Due_Date_code_Listener.jpgTEST-247.jpgTEST-258.jpg

2 answers

1 accepted

0 votes
Answer accepted
Steve Barker
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 9, 2012

Atlassian solved this issue for us with a software update. The issue had started to affect more users and so was becoming more critical. The cause turned out to be casing differences in the email addresses exposed by the source of our SSO system.

0 votes
Abdulrazaq Mohammed Ali Omar
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
September 18, 2012

Hello Steve,

I have taken over the issue you have logged in support.atlassian.com, and should work on it shortly.

All the best.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events