Forums

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

How to add an entry for a Custom Label in a Post Function Script

Wayne Cranford
July 3, 2019

Environment:
JIRA v7.4.4, 
ScriptRunner 5.3.5

Using "Clone an issue, and link" to create up to 50 product specific issues, and need to automatically populate a custom label field named "Agile Team" with the team that is responsible for that product area.  Already using Additional issue action" to customize a numbers of fields (Summary, Component, a Cascading Select, Watcher, Assignee) , based on the specific product area,  but cannot find a recipe for populating a Custom Label field. Below is an example of what is already working.

Thanks,

Wayne

import com.atlassian.jira.ComponentManagerimport com.atlassian.jira.issue.customfields.manager.OptionsManager
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.project.Project
import com.atlassian.jira.user.util.UserManager
import com.atlassian.jira.issue.watchers.WatcherManager

def project30 = issue.getProjectObject()
def componentManager = ComponentManager.instance
def optionsManager = ComponentManager.getComponentInstanceOfType(OptionsManager.class)
def userUtil = ComponentAccessor.getUserUtil()

MutableIssue issue = issue

def projectComponentManager30 = ComponentAccessor.getProjectComponentManager()
def newcomponent30= projectComponentManager30.findByComponentName(project30.getId(), "Ethernet RG")
 issue.setComponent([newcomponent30])

String SUMMARY_VALUE30 = issue.summary
String newSummary30 = "Security Vulnerability (OEM RG/AP (Inteno)) - "+SUMMARY_VALUE30

def customFieldManager3011 = ComponentAccessor.customFieldManager
def optionsManager3011 = ComponentAccessor.optionsManager
def issueManager = ComponentAccessor.issueManager
def productCat3011 = customFieldManager3011.getCustomFieldObjectsByName("Product Category")[0]
def fieldConfig = productCat3011.getRelevantConfig(issue)
def options = optionsManager3011.getOptions(fieldConfig)
def parentOption3011 = options.find { it.value == "Ethernet RG" }
def childOption3011 = parentOption3011?.childOptions?.find { it.value == "" }
def newValues = [:]
newValues.put(null, parentOption3011)
newValues.put("1", childOption3011)
issue.setCustomFieldValue(productCat3011, newValues)

issue.assigneeId = "rmenakat"
issue.summary = newSummary30
checkLink = {link -> false};

 

1 answer

1 accepted

Suggest an answer

Log in or Sign up to answer
0 votes
Answer accepted
Bibek Behera
Community Champion
December 4, 2020

Hi @Alex Dukhon ,

The notification can only be trigged at issue level when the test is assigned to someone. This is mainly because the email triggering feature is mostly controlled by JIRA for it's core features. As a plugin vendor, zephyr will not be able to use the email for zephyr's functional area. As the test itself is a issue inside JIRA the issue level features applies to Test.

The user can only be notified at the test level assignment for now.

-Bibek

TAGS
AUG Leaders

Atlassian Community Events