Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Create a template on behaviours based on two or more component at same project jira

Edimara June 17, 2022

Hi friends!

I am trying to create a template in behaviour at same project Jira but only specifc component. 
I create a server side script but its not work:

 

 

import com.atlassian.jira.bc.project.component.ProjectComponent
def desc = getFieldById("description")
def transition = getActionName()
def component = getFieldById(getFieldChanged())
List <ProjectComponent> comps = component.getValue() as List


if (transition.toString() == "Create"){
if (issueContext.issueType.name == "Task") {
if(!component.toString().contains("Gestão de Demandas")|| (!component.toString().contains("Gestão de Projetos"))){
def defaultValue = """

*[Objetivo]* - Qual a finalidade da minha demanda, por que tenho esse pedido?

*[Como]* - Descrever sugestão de solução para o problema

*[Dor]* - Descrever cada problema a ser resolvido

*[Benefício Esperado]* - Descrever o benefício esperado com este pedido

*[Quem solicitou]* - Foi você que pensou na demanda ou alguém que o solicitou?

""".replaceAll(/ /, '')

if (! underlyingIssue?.description) {
desc.setFormValue(defaultValue)
}
}
if (!component.toString().contains("Gestão de Demandas") || (!component.toString().contains("Gestão de Projetos"))){
def defaultValue = """
""".replaceAll(/ /, '')

if (! underlyingIssue?.description) {
desc.setFormValue(defaultValue)
}
}

}
}


if (transition.toString() == "Create"){
if (issueContext.issueType.name != "Task") {
def defaultValue = """


""".replaceAll(/ /, '')
}
}

 


if (transition.toString() == "Create"){
if (issueContext.issueType.name != "Task") {
def defaultValue = """


""".replaceAll(/ /, '')
}
}

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Antoine Berry
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 21, 2022

Hello @Edimara ,

I have not tried exactly your script but it looks fine, have you checked the logs for any error ?

TAGS
AUG Leaders

Atlassian Community Events