JMWE - Setting the value of a field with scheduled actions

FMassaro July 15, 2020

Hello everyone,

 

I am trying to automate some reports from Jira, to try and control issues already over budget (Time spent > Original Time Estimate) and try and prevent other issues from going over budget. 

I couldn't do this by simply using filters (as you can't compare two field with JQL expressions) and therefore I had to resort to using JMWE scheduled actions to populate a custom field (which I called, imaginatively, "Over Budget?" - a number only, single line custom field) with two values "0.75" (for issues where time spent is > than 75% of the original time estimate) and "1" (for issues already over budget). I can then create a filter and a subscription on the back of these values to automatically report on whether we are keeping in budget or not.

I then proceed to create the following post functions within the same shared action:

Capture.PNG

The issue is that the 0.75 one applies to tickets over budget as well and I can't really wrap my mind around why this is happening.

The warnings I am getting are all the same:  "Error while calling Jira REST API. Retrying." - possibly related to time outs due to the high number of issues that need to be crunched by the post functions (> 500) 

I get two different type of errors:

- Unexpected response: 500 (possibly related to the post functions timing out)

- Cannot set property 'issuekey' of undefined (I don't understand this at all tbh)

FYI the scope of the shared action is: 
issuetype = task AND status != done AND originalEstimate > 0 AND timespent > 0

Think there's something pretty obvious I am not seeing - any suggestions on how to get this to work? 

 

thanks

1 answer

0 votes
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 15, 2020

Hi,

one problem is with the syntax of your conditional execution condition. The "AND" should be inside the {{ }}.

Also, you don't need two post-functions for that - instead, you should set the field's value based on the condition:

{% if issue.fields.timespent >= issue.fields.timeoriginalestimate %}
1
{% elif issue.fields.timespent >= issue.fields.timeoriginalestimate * 0.75 %}
0.75
{% endif %}

As for the 500 errors, they are internal Jira errors, and if they persist, you'll need to reach out to Atlassian support so they can investigate.

Also, note that your approach will not fully work, as there is a limit to the number of issues the scheduled action can process, and you'll be reaching it quickly. What you need is "calculated fields", and this is something Atlassian might eventually bring to Jira Cloud.

Suggest an answer

Log in or Sign up to answer