Automation for Jira: Calculation of date and number fields after fieldChange

Sebastian L. March 4, 2021

Dear forum users,

 

i need your help with an automation problem: We are using Automation for Jira Server 7.2.3

For recalculation of a derivative due date when another number field is changed we created a Field Value Change Rule with the following edit action:

Field Due date is set to {{issue.customfield_10705.minusWeeks(fieldChange.to)}}

where 

  • issue.customfield_10705 is a date field and
  • the changed field is a number field

and fieldChange is expected to contain a number, but it seems it doesn't, because everything i tried led to the deletion of the due date. I failed already with:

  • {{issue.customfield_10705.minusWeeks(fieldChange.to)}}
  • {{issue.customfield_10705.minusWeeks(fieldChange.toString)}}
  • {{issue.customfield_10705.minusWeeks(fieldChange.to.asNumber)}}
  • {{issue.customfield_10705.minusWeeks(fieldChange.toString.asNumber)}}
  • {{issue.customfield_10705.minusWeeks(fieldChange.toNumber)}}

Could you please give me a hint how to convert the data in the fieldChange into a number that can be used for calculations ?

 

Thank you very much for your help in anticipation,

Sebastian

1 answer

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 4, 2021

Hi @Sebastian L. 

For something like this, please post an image of your rule to provide some context; that will help the community suggest ideas to you.

Have you tried logging the values to the audit log to see what they contain within the rule?

If your fieldChange field is already a number, you should not need to convert it.  Or, by fieldChange do you actually mean the field which changed to trigger the rule?  If so, please consider directly referencing that field's name (smart value) with no suffix, such as ".to" or ".toString".

Best regards,

Bill

Suggest an answer

Log in or Sign up to answer