Forums

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

Can't create two separate behaviours with server side script on Component/s field

Susan Tennant
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 9, 2021

I created  a behaviour with following server side script based on field Component/s and mapped it to my project/issue type and it works as expected.

import com.atlassian.jira.bc.project.component.ProjectComponent
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours behaviours
def desc = getFieldById("description")
def descValue = desc.getValue()

def templateDGDesignComponentDesc = "THIS IS TEMPATE"

def components = getFieldById(getFieldChanged()).getValue() as List<ProjectComponent>

if (getActionName() == "Create" || getActionName() == "Create Issue") {
if (! underlyingIssue?.description) {
if (descValue == "") {
if (components.any {it.name.contains("DG Design")}) {
desc.setFormValue(templateDGDesignComponentDesc)
}
}
}
}

 

However, when I try to create a new behaviour, which I plan to map to a different project, the minute I select field Component/s and click on Server Side Script, the above code appears, if I update the code and save, it overrides the code in my previous behaviour.

 

Can I not have two behaviours for two separate projects with separate server side code based on Component/s field?

 

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Dave Theodore [Coyote Creek Consulting]
Community Champion
February 19, 2020

Next time, inactivate them in AD, wait for the changes to sync in to Jira and then delete the users from AD.  You'll need to manually inactivate them in Jira to clean things up now. You could also write a script to batch change them via the REST API or use the Jira CLI.

TAGS
AUG Leaders

Atlassian Community Events