Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

I want to use If function in additional fields

Parto Hamidi August 12, 2025

I want to use the below function to rotate a task assignment for alternate months. But it returns the error: Error while parsing additional fields - Mismatched start/end tags: null != in template-fed1c93e-02d3-45d9-8839-abedb2902b91:5

A600 and A161 are the Jira names of the assignees

{,
"assignee": {
"name": "{{if(equals({{#=}}{{now.format("M")}} % 2{{/}}, 0), "A600", "A161")}}"
}
}

 

Could you please help me how to fix it?

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.
August 12, 2025

Hi @Parto Hamidi 

Short answer: I recommend breaking down this problem into pieces, and using created variables to help.

 

There are several reasons why that expression cannot be done in a single step, and there is an error / typo in the JSON...

A simple JSON expression to set the assignee this way would be this:

{
"fields": {
"assignee": {
"name": "A600"
}
}
}

Note how the JSON expression has quotation marks around the "A600" value.  But you have also wrapped if() function in quotation marks, nesting them and so causing errors.

 

And you want to use the format of the if() function (without the pound sign) which can return a true or false value.  I know that works for Jira Cloud automation, but it is not listed in the documentation for Data Center.  Have you tested if that one works?  Let's assume it does not.

 

Next, the if() function is correctly surrounded by double-curly brackets.  As a result, you cannot nest a math expression inside of that because it would also require the brackets.

 

Putting all of this together, you could first capture the result of the math operation in a created variable.  Then use that variable in the conditional expression to select the user name.

  • action: create variable
    • name: varMonthModulo
    • smart value:
{{#=}}{{now.format("M")}} % 2{{/}}
  • action: create variable
    • name: varSelectedUser
    • smart value: 
{{#if(equals(varMonthModulo, "0"))}}A600{{/}}{{#if(not(equals(varMonthModulo, "0")))}}A161{{/}}
  • action: edit issue, with the JSON of
{
"fields": {
"assignee": {
"name": "{{varSelectedUser}}"
}
}
}

 

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer