Forums

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

Add template with Scriptrunner Behaviours

nihcet September 3, 2019

Hi,

When opening a issue with a scriptrunner behavior, I add template text to the description field and after modify it. But if I click "Create" without adding it to a required field, it applies the template again.

How do I prevent the template from applying even if the required field is forgotten?

 

import com.onresolve.jira.groovy.user.FormField

FormField descField = getFieldById("description")

// Custom Field'de seçeneğini giriniz.
def prt = "PRT"

// Aşağıdaki alana description alanında görünmesini istediğiniz şablonu giriniz.
def temp = """
Template text.
Template text.
Template text.
Template text.
"""

def cf = getFieldById(getFieldChanged())
if (null != cf) {
String[] values = (String[])cf.getValue();
if (getActionName() != "Create Issue") {
if (values.length == 2) {
if (values[1] == prt) {
if (! underlyingIssue?.description)
descField.setFormValue(temp);
}
}
}
}

 

1 answer

0 votes
Alex Koxaras -Relational-
Community Champion
November 5, 2022

Hi @nihcet 

If you want this behaviour to be applied only to specific transition, then you can choose it from the conditions of the chosen field.

Suggest an answer

Log in or Sign up to answer