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}"/>
        </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

This widget could not be displayed.

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;





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)

This widget could not be displayed.

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

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

54 views 1 0
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