Forums

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

set default / pre filled "Epic link" value on create issue using behavior

sgole
Contributor
February 3, 2021

hii ,

can anyone please help me with this ,

i want to set default value for Epic Link . Thanks in advance 

image.png

2 answers

1 accepted

Suggest an answer

Log in or Sign up to answer
2 votes
Answer accepted
Jia Jie
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 3, 2021

Hi @sgole

You can try to apply the sample script below in the Behaviour Initialiser:

import com.atlassian.jira.component.ComponentAccessor

// Get Epic Link field and it's value
def epic = getFieldByName("Epic Link")
def value = epic.getValue() as String


if(getActionName() == "Create" && value == null ){
//Set epic link
epic.setFormValue("RAIN-12")
}

I'm using Scriptrunner 6.18.0 and Jira 8.13.1.

Hope you found this useful!

sgole
Contributor
February 4, 2021

hii @Jia Jie  Thanks for your help , in my case i was trying to set JIRA in setFormvalue ex. setFormvalue("JIRA") ,

instead of setFormvalue("EEHQAN-2") works :). 

image.png

Jia Jie
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 4, 2021

Hi @sgole ,

Glad that it works now and I'm happy to help!

sgole
Contributor
February 4, 2021

@Jia Jie , can you please help me to set  default "sprint" field also

Jia Jie
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 4, 2021

Hi @sgole ,

It's similar to the sample script above. Try to get your sprint by its Id, then set it with sprint id.

//Get Sprint field by its id
def sprint = getFieldById("customfield_10101")

//Set the default sprint with sprint id
sprint.setFormValue(1) 

 You can refer to the community post here on getting the sprint id.

Like sgole likes this
sgole
Contributor
February 4, 2021

@Jia Jie Thanks  it works . 

Like Jia Jie likes this
0 votes
Irfan Mazuki February 3, 2021

Hi @sgole ,

I found this resolved Atlassian Community discussion to be relevant to this case: Create a default Epic Link using Behavior . Do check it out if it suits your requirement.

I hope this helps.


Kind regards,
Irfan

sgole
Contributor
February 3, 2021

@Irfan Mazuki  thanks for reply . i have already tried this but wont work for me .

TAGS
AUG Leaders

Atlassian Community Events