Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

In JMWE build your own script post function Enable to execute Nunjucks script

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


1 answer

1 accepted

0 votes
Answer accepted
David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Mar 30, 2023

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.

@David Fischer _Appfire_ Thanks it work perfectly for me 

Suggest an answer

Log in or Sign up to answer
Site Admin
AUG Leaders

Atlassian Community Events