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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

1 accepted

0 votes
Answer accepted

Hi Susan, 

May I know which Scriptrunner version you're currently using?

It seems like related to this bug: SRJIRA-4418 which had been fixed in Scriptrunner 6.5.0.

Thank you so much for your help. You were correct, I upgraded our version of Scriptrunner from 6.2.1-p5 to the latest version 6.21.0 and the issue is now resolved.

Appreciate your guidance.

Suggest an answer

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

Admins, notify your Jira instance of system-wide changes with the new admin announcement banner

Hi All! We’re excited to share the launch of an announcement banner that lets Jira site administrators communicate directly to their users across their  Jira Cloud instance.  ...

527 views 15 17
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