Transition issues when inactive in a specific state with custom field

Ruben Demey August 10, 2014

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}"/>
        </core:forEach>
</jira:Login>
</JiraJelly>

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

0 votes
Mehmet Kazgan
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.
August 11, 2014

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:

https://answers.atlassian.com/questions/118367/assign-an-issue-based-on-radio-button-selection-groovy

0 votes
Mehmet Kazgan
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.
August 10, 2014

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;
        &lt;/core:invoke&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;
            &lt;/core:invoke&gt;





Ruben Demey August 11, 2014

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)

Suggest an answer

Log in or Sign up to answer