Forums

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

security level field value should update based on cascading custom field on issue update &create

saroja muninaga October 26, 2018

Automatically security level field update based on cascading custom field value in issue create and issue update .

Thanks in advance 

2 answers

1 accepted

0 votes
Answer accepted
Petter Gonçalves
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 26, 2018

Hello Saroja,

You can use Automation for JIRA to achieve this kind of functionality:

Screen Shot 2018-10-26 at 12.35.01.png

Please, let me know if this option works for you.

saroja muninaga October 26, 2018

@Petter Gonçalves thanks for  your suggestion.

 

Is there any way to do through code using scrip runner or through jira plugin ?

Petter Gonçalves
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 26, 2018

Hello Saroja,

I'm not aware on how to build a Script using Script Runner to achieve this functionality, however, I think That the analysts from Adaptavist (maybe @Nic Brough -Adaptavist-) Could give you some insights about it.

Also, here's the ScriptRunner documentation:

Adaptavist Script Runner

Nic Brough -Adaptavist-
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 Leaders.
October 26, 2018

I can't say I'm an expert scripter!

But these two snippets could be bolted together:

This gets the current value from a cascading select and looks for "USA / California"

 

def values = [ "USA", "California" ]

def customFieldManager = ComponentAccessor.getCustomFieldManager()


def cascadingSelect = customFieldManager.getCustomFieldObjectsByName("My cascading field")[0]

def cascadingOptions = issue.getCustomFieldValue(cascadingSelect) as Map


def cascadingValues = [
cascadingOptions.get(null) as String,
cascadingOptions.get("1") as String
]

if (cascadingValues == values) {


(do something)

}

And this sets a security level, assuming you know the id of the level you want to set is 10010 :

issue.setSecurityLevelId(10010)
Petter Gonçalves
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 26, 2018

Thanks a lot for this useful information, @Nic Brough -Adaptavist-

@saroja muninaga Can you check if you are able to build the script as you need with the code provided by Nic?

Additionally, I would like to ask you again to also refer to the Script Runner documentation 

saroja muninaga October 29, 2018

Thank you so much @Nic Brough -Adaptavist- @Petter Gonçalves.

I have achieved through script listener . 

And we need to update explicitly  an issue in script like below 


 issueManager.updateIssue(user, issueToUpdate, EventDispatchOption.ISSUE_UPDATED, false)

0 votes
saroja muninaga October 26, 2018

Thanks petterson for your suggestions.

Is there any way to do with coding using script runner ?

Or through jira plugin development?

 

Thanks in advance

Suggest an answer

Log in or Sign up to answer