Forums

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

Add a second Issue type to an existing hierarchy level

Drew Watson
September 20, 2022

In Settings-> Issues -> Issue Type Hierarchy

 

I currently have a hierarchy of:

 

- Programme

- Initiative

- Epics

- Story (and all other standard types)

- Sub Task

I want to add a second issue type at the same level at initiative:

- Programme

- Initiative, Milestone

- Epics

- Story (and all other standard types)

- Sub Task

 

I'm hoping I can use it (Milestone) on Advanced Roadmaps to show major milestones like Customer deadlines.

My concern is that when I try to add it to the hierarchy I get this message:

 

"Are you sure you want to change the hierarchy configuration?

Moving or changing hierarchy levels of issue types will break existing parent links in all company-managed projects in your site. This change can't be reversed."
I'm not inserting a new hierarchy level so I can't see an issue - but I also don't trust Jira not to just drop all the links between the Epics and Initiatives across the entire company...
Has anyone tried this?

1 answer

0 votes
Suhas 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.
June 18, 2018

It depends how the value of scripted field changes. Either you fire a custom event upon value set OR configure a Escalation service which will run in intervals to check the value and runs a script which transitions the issue. 

Have a look IssueService class for triggering the transition from script. I will try to make a script when I have time :)

IssueService.TransitionValidationResult
Shivaprasad Hattaraki
Contributor
June 19, 2018
import com.atlassian.jira.component.ComponentAccessor

def issueManager = ComponentAccessor.issueManager
def customFieldManager = ComponentAccessor.customFieldManager

def warrantyField = customFieldManager.getCustomFieldObjectByName("Valid Warranty Date")

def warranty = issue.getCustomFieldValue(warrantyField)
def systemDate = new Date()

if(warranty == null){
return("<p style=color:blue>Please Enter Valid Warranty Date</p>")
}else if(warranty < systemDate)
{
return("<p style=color:red>INVALID</p>")
}else
{
return("<p style=color:green>VALID</p>")

I have this code in script field based on these values i need to transit status automatically from "IN PROGRESS" to "VALID DATE" or "INVALID DATE".

could we able to do this using listener or not plz let me know if possible. 

Shivaprasad Hattaraki
Contributor
June 19, 2018

Hi Suhas,

Could you plz help me in  this issue?

Suhas 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.
June 19, 2018

i think in the same script you can put code in IF statement to transition the issue. Transition issue code looks like this.

Try following code. Use respective transition ids in both if statements. You can find transition IDs in transition name. they are written in brackets (11) like this.

import com.atlassian.jira.component.ComponentAccessor

def issueManager = ComponentAccessor.issueManager
def customFieldManager = ComponentAccessor.customFieldManager
def issueService = ComponentAccessor.getIssueService()

def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

def warrantyField = customFieldManager.getCustomFieldObjectByName("Valid Warranty Date")

def warranty = issue.getCustomFieldValue(warrantyField)
def systemDate = new Date()

def issueInputParameters = issueService.newIssueInputParameters()
issueInputParameters.with {
setSkipScreenCheck(true)
}

if(warranty == null){
return("<p style=color:blue>Please Enter Valid Warranty Date</p>")

def validationResult = issueService.validateTransition(user, issue.id, transitionID, issueInputParameters) //actionID is transition id, you can see it in the workflow
if (validationResult.isValid()) {
// Perform the transition
def issueResult = issueService.transition(user, validationResult)

}

}else if(warranty < systemDate)
{
return("<p style=color:red>INVALID</p>")

def validationResult = issueService.validateTransition(user, issue.id, transitionID_2, issueInputParameters) //actionID is transition id, you can see it in the workflow
if (validationResult.isValid()) {
// Perform the transition
def issueResult = issueService.transition(user, validationResult)
}
}else
{
return("<p style=color:green>VALID</p>"
}
Shivaprasad Hattaraki
Contributor
June 20, 2018

 have tried but not working.

I have tried with script listener but not working.

Suhas 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.
June 20, 2018

Its syntax errors I guess. have you tried adding those missing brackets { s? I have updated now. 

Shivaprasad Hattaraki
Contributor
June 20, 2018

yaa i have tried with adding  those brackets { but not working.

Shivaprasad Hattaraki
Contributor
June 20, 2018
import com.atlassian.jira.component.ComponentAccessor

def issueManager = ComponentAccessor.issueManager
def customFieldManager = ComponentAccessor.customFieldManager

def warrantyField = customFieldManager.getCustomFieldObjectByName("Valid Warranty Date")

def warranty = issue.getCustomFieldValue(warrantyField)
def systemDate = new Date()

return warranty > systemDate

Could you make transition for this?

Value returns true or false boolean values.

 

if it returns true the transition validate date(21) action id has to perform else invalidate(31) action id has to perform. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events