You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hello everyone
Actually I am trying to change my original estimate values based on custom field value Like if we have 10H in original estimate and we enter 50 in number field it will subtract the 50% from the original estimate then it become 5H when specific transit happen for that I bulid a post function in JMWE but it give error
{%- if issue.fields.customfield_10185 is defined and issue.fields.timeoriginalestimate is defined -%}
{%- set customFieldValue = issue.fields.customfield_10185.value %}
{%- set originalEstimate = issue.fields.timeoriginalestimate.value %}
{%- set percent = customFieldValue / 100 %}
{%- set newEstimateSeconds = originalEstimate - (originalEstimate * percent) %}
{%- set newEstimateHours = newEstimateSeconds / 3600 %}
{%- set update_params = {"timeoriginalestimate": {"value": newEstimateHours}}-%}
{{- issue.updateIssue(update_params) -}}
{%- endif -%}
Following is the error:
(string) [Line 7, Column 23] Error: Unable to call `issue["updateIssue"]`, which is undefined or falsey
Hi @Umar Maroof ,
Build-your-own post functions are meant to use the Jira REST API directly to make changes to Jira. You cannot update fields the way you did.
Also, there are a few errors in your script. For example, if customfield_10185 is a Number field, its value is directly issue.fields.customfield_10185, not issue.fields.customfield_10185.value (which would be for a Select-type field). Same for timeoriginalestimate. You can see all this on the "Issue Fields" help tab below the editor.
Furthermore, the timeoriginalestimate field expects a number of seconds, not hours.
Instead, you should use a Set Issue Fields post function, select the Original Estimate as the field to set, and for the value use the following script:
{%- if issue.fields.customfield_10185 is defined and issue.fields.timeoriginalestimate is defined -%}
{%- set customFieldValue = issue.fields.customfield_10185 -%}
{%- set originalEstimate = issue.fields.timeoriginalestimate -%}
{%- set percent = customFieldValue / 100 -%}
{%- set newEstimateSeconds = originalEstimate - (originalEstimate * percent) -%}
{{- newEstimateSeconds -}}
{%- endif -%}
and you should select the "Ignore empty value" option to avoid modifying the Original Estimate if one of the fields is empty.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.