Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,298,205
Community Members
 
Community Events
165
Community Groups

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

Edited
Edimara I'm New Here Jun 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

0 votes
Antoine Berry Community Leader Jun 21, 2022

Hello @Edimara ,

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

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

An update on Confluence Cloud customer feedback – June 2022

Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...

159 views 1 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you