Default Subtask issue type using behavior

Veera I'm New Here Nov 02, 2017

I've created a Script fragment to create a subtask, Please see below xml similar to the one mentioned here(

 <web-item key='createFeed' name='ScriptRunner generated web item - createFeed' section='operations-top-level' weight='1'>
    <condition class='script:jiraHelper.project?.key == "ABC"&amp; == "Story"'/>
     <link linkId='createFeed'>/jira/secure/CreateSubTaskIssue.jspa?parentIssueId=${}&amp;pid=${}&amp;issuetype=11111</link>

Error: I have 2 subtasks types, because of jira's default behavior the issue type is selected to the latest subtask issue type created.

Steps taken to solve the error: I tried using the Behaviours integration to set the issue type to default, Please see below script as mentioned in the documentation:

    import com.atlassian.jira.component.ComponentAccessor
    import com.atlassian.jira.issue.IssueManager;

    def issueManager = ComponentAccessor.getIssueManager()
    if (getBehaviourContextId() == "createFeed") {       getFieldById("issuetype-field").setReadOnly(true)

But this doesn't work. Am I missing anything or is this because of the styleClass I've used. issueaction-create-subtask

I need the subtask screen to popup when the script fragment button is clicked, with the issue type field set as read only.

Pleas advise. Thanks.

1 answer

0 votes
Alexey Matveev Community Champion Nov 02, 2017


In the following line


 What do you use for issuetyle-field? It must be like customfield_<id>. If you use the name of the custom field you need to call getFieldByName method. 

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,950 views 12 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot