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

How to validate non empty number fields in automation with regular expressions

Hi team,

We have some automations which are calculating the costs or time of the projects depending on the rate (customfield_10181), actually we have this expressions to calculate it:

To the costs we multiply the hours with the rate and to the opposite we divide it:


{{#=}}{{issue.ENE21 Plan H}} * {{issue.customfield_10181}}{{/}}

{{#=}}{{issue.FEB21 Plan H}} * {{issue.customfield_10181}}{{/}}

{{#=}}{{issue.MAR21 Plan H}} * {{issue.customfield_10181}}{{/}}


{{#=}}{{issue.ENE21 Plan €}} / {{issue.customfield_10181}}{{/}}

{{#=}}{{issue.FEB21 Plan €}} / {{issue.customfield_10181}}{{/}}

{{#=}}{{issue.MAR21 Plan €}} / {{issue.customfield_10181}}{{/}}


This are working fine but there are showing errors if the users are deleting the values and putting some number field on null, we tried to use some expressions to controlling it but it doen't work fine either, I think it can be something like this:


{{#=}}{{IF(issue.ENE21 Plan H == null, 0, issue.ENE21 Plan H)}} * {{issue.customfield_10181}}{{/}}
{{#=}}{{IF(issue.FEB21 Plan H == null, 0, issue.FEB21 Plan H)}} * {{issue.customfield_10181}}{{/}}
{{#=}}{{IF(issue.MAR21 Plan H == null, 0, issue.MAR21 Plan H)}} * {{issue.customfield_10181}}{{/}}
{{#=}}{{IF(issue.ABR21 Plan H == null, 0, issue.ABR21 Plan H)}} * {{issue.customfield_10181}}{{/}}


{{#=}}{{IF(issue.ENE21 Plan € == null, 0, issue.ENE21 Plan €)}} / {{issue.customfield_10181}}{{/}}
{{#=}}{{IF(issue.FEB21 Plan € == null, 0, issue.FEB21 Plan €)}} / {{issue.customfield_10181}}{{/}}
{{#=}}{{IF(issue.MAR21 Plan € == null, 0, issue.MAR21 Plan €)}} / {{issue.customfield_10181}}{{/}}


If someone knows how to solve it, it would be very helpfull to our team.

Thanks in advance,


2 answers

0 votes
Simmo Atlassian Team Jun 14, 2022

Hi @Mario Benedi Plana

You can add default values to your smart values to catch a missing value and stop the expressions breaking. Just add |0 to it. For example:


Will default to 0 if there is no value.

Hopefully that helps.




In fact, if the field is of type number field, leaving the value empty or null will cause automation errors or the final result to appear incorrect.

Instead, try to instruct your users to use the number 0 or 1 and not leave the number field empty.

I think this will be enough to help you.

If this doesn't work or it's not interesting to apply, please let me know. We can try other ways.

Hi Fernando,


thanks for the quick response :)

We already put warning messages in the forms to prevent the users deleting values saying they must put 0 values, but sometimes they don't do it well and delete it anyway.

For prevent that errors we want to control it with some expression.


Also we think when the Scriptrunner Behaviours are able in cloud it could solve this right?

Suggest an answer

Log in or Sign up to answer
Site Admin
Community showcase
Published in Jira Service Management

Coming Soon: Insight Changing to Assets

The 2020 acquisition of Mindville added powerful asset and configuration management capabilities to Jira Service Management in the form of Insight. Following the completion of that integration, custo...

350 views 3 11
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you