Automatically security level field update based on cascading custom field value in issue create and issue update .
Thanks in advance
Hello Saroja,
You can use Automation for JIRA to achieve this kind of functionality:
Please, let me know if this option works for you.
@Petter Gonçalves thanks for your suggestion.
Is there any way to do through code using scrip runner or through jira plugin ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks petterson for your suggestions.
Is there any way to do with coding using script runner ?
Or through jira plugin development?
Thanks in advance
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.