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

1 vote
Answer accepted
Timothy
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 30, 2013
Séb P.
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 30, 2013

Hum, that seems exactly what I need :) I will give a try!

Thank you :)

0 votes
VikasB
Contributor
August 26, 2016

Plan runners add on adds task to run build plans, test plans, create release, re-deploy , promote deployments or rollback releases as well as REST API

https://marketplace.atlassian.com/plugins/com.mdb.plugins.planrunners/server/overview

Hope this helps.

Suggest an answer

Log in or Sign up to answer