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,293,782
Community Members
 
Community Events
165
Community Groups

Scriptrunner Behaviour on description on issue creation and if a component is selected

Hi,

 

I would like to know if it's possible to prefile with a behaviour the description field only if a component is selected (for exemple if component selected = A then description = A else description is empty).

I have already this code but i don't know how to filter on component selected event:

def desc = getFieldById("description")
def issueType = getFieldById("issuetype")

def defaultStory = """
text 
"""
def defaultBug = """\
text2
"""
def defnull = """ """
if (getActionName() == "Create" && issueContext.projectObject.key == "PROJ"){

if (issueContext.issueType.name =="Story"){
desc.setFormValue(defaultStory)
}
else if (issueContext.issueType.name =="Bug"){
desc.setFormValue(defaultBug)
}
else {
desc.setFormValue("")
}
}
else if (getActionName() == "Create" && issueContext.projectObject.key != "PROJ") {
desc.setFormValue("")
}

Could you help me on this subject?

 

Thank you in advance.

Regards,

Mickael O 

1 comment

Mickael - It sounds like you are on track. Try to go over the program again and see if you can work it out. I'll do the same and see if I can come up with something as well. 

Good Luck!

Comment

Log in or Sign up to comment
TAGS
Community showcase
Published in Jira Software

Upcoming changes to epic fields in company-managed projects

👋 Hi there Jira Community! A few months ago we shared with you plans around renaming epics in your company-managed projects. As part of these changes, we highlighted upcoming changes to epics on...

14,127 views 34 44
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