The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
  • Community
  • Q&A
  • Jira
  • Questions
  • JMWE: Conflicting results when using same code in workflow validator & copy issue field postfunction

JMWE: Conflicting results when using same code in workflow validator & copy issue field postfunction

Steven Rhodes
Contributor
February 10, 2022

I have a JMWE Field Required Validator in a workflow that successfully requires a user to provide a field if the value of another field is true. This field is a simple select dropdown with Yes and No. 

image.png

In the same workflow I have two post functions that uses the same code to determine whether to Copy Issue Fields from another issue, and a Create Issue post function. This returns false. This Nunjucks code is identical except for the necessity of providing {{. What am I doing wrong?

image.png

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
David Fischer
Community Champion
February 10, 2022

Hi @Steven Rhodes 

The syntax is different between post functions and conditions/Validators, because the latter are limited to Atlassian's Jira expressions. 

You can use the Issue Fields help tab of the editor to find out how to access your field from Nunjucks. 

Steven Rhodes
Contributor
February 10, 2022

I followed your advice, and yes it led me to the fact that I needed the fields part

{{ issue.fields.customfield_20423.value == "Yes" }}

So I'm accepting this answer.

0 votes
Tom Lister
Community Champion
February 10, 2022

Try 

{{ issue.fields.customfield_20423 == "Yes" }} 

in the nunchuck condition

Steven Rhodes
Contributor
February 10, 2022

I saw @David Fischer 's answer first, but this was definitely the right direction. However, it didnt work because I would still need the .value on the end. I probably would have worked it out from your answer tho as I'd already stated the suffix in my attempt. Thanks!

Like Tom Lister likes this