Transition issues when inactive in a specific state with custom field

I'm trying to create a simple Jelly Runner script to close issues in a certain project that have not been updated in two weeks. During the transition, a screen is defined with a required custom field.

This is what I got now:

<JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.enterprise.JiraTagLib" xmlns:core="jelly:core" xmlns:log="jelly:log" >
<jira:Login username="rdem" password="XXXXXX">
        <log:warn>Running Inactive issues service</log:warn>
        <core:set var="comment">This issue is marked as Done, but has not been closed for two weeks.
An automated service will now close the ticket, and set the feedback to "Neutral".
Thank you,
  The IBQ team</core:set>
        <core:set var="workflowStep" value="Close" />
        <core:set var="workflowUser" value="rdem" />
        <!-- Run the SearchRequestFilter -->
        <jira:RunSearchRequest filterid="12345" var="issues" />
        <core:forEach var="issue" items="${issues}">
                <log:warn>Inactivating issue ${issue.key}</log:warn>
                <jira:TransitionWorkflow key="${issue.key}" user="${workflowUser}" workflowAction="${workflowStep}" comment="${comment}"/>

But this won't work, because during this transition, a certain custom field is required and I've no idea how to specify the default value for this field.

Any help please?

2 answers

1. You need to add this line before <core:set...> (line 10):

&lt;!-- Get CustomField object from customFieldManager --&gt;
        &lt;core:invoke on="${customFieldManager}" method="getCustomFieldObjectByName" var="myField"&gt;
            &lt;core:arg type="java.lang.String" value="Your custom field name"/&gt;

2. Then, add this line to update the value with whatever value you want after &lt;/log:warn&gt;
&lt;!-- update your custom field value - XXXXX--&gt;
            &lt;core:invoke on="${myField}" method="updateValue" var="updFieldValue"&gt;
                &lt;core:arg type="java.lang.String" value="[customfieldvalue - XXXXX]"/&gt;

Thanks for the reply. I'm trying but it's not working. I assume the approach is a little different if the custom field are a bunch of radio buttons?

Also, so I have to enter the name of the custom field or something more internal? (id)

Custom field name should work, not the id. Id needs to be used for the value of the custom field.

And for the radio button, check here:

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,097 views 4 9
Read article

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