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

Smart Values Condition syntax for forms data

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 3, 2024

Hi All,

I have a question about the syntax needed for the validation of forms data for a condition. 

Screenshot 2024-12-03 181608.png

 

As you can see in the image, I have a Forms field (short text) that I am checking to see if it has a value or not. It is the beginning of a condition with lots of other fields after it. If it is empty, I need the rule to stop. 

However, I can't get the syntax right to keep it from passing the validation. The field has no value in it for sure, but I have tried some different combinations including Not Equal to Empty and it always passes even through the form field is empty. 

Any ideas? Also, creating a custom field and linking it is not an option - I have several other checks in the form that need to be followed or whether they are empty or not as well. 

@Bill Sheboy  - can ya help a brother out? 

 

2 answers

2 accepted

1 vote
Answer accepted
Heather Ronnebeck
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 3, 2024

Hey, 

Have you taken a look at this doc?

https://support.atlassian.com/jira-service-management-cloud/docs/access-smart-values-for-forms-and-form-fields/

From what I can see, you might need to do something like {{forms.last.c4p4-brand}} or potentially {{forms.last.c4p4-brand.label}}

I hope this helps a bit.

Jack Brickey
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 3, 2024

that would be my guess as well. interested to see if it works. :-)

Heather Ronnebeck
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 3, 2024

I would also add that for the Regex part. The word Empty won't work as Regex is very specific. I'd leave it blank and change the second field to to be that it does match the regex. 

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 3, 2024

Thanks @Heather Ronnebeck  - But what I want is it is is not empty or not blank. If you clear it out, it leaves the word Empty in there as a watermark more or less and the description actually shows it as not equal to empty or something along that line. I am suspicious of the regex also but can't find the right syntax there. 

Dirk Ronsmans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 3, 2024

@John Funk ,

Have you tried outputting the value to the log (both empty and with a value)?

That should give you a direction to work towards

Like Bill Sheboy likes this
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.
December 3, 2024

Yes, and...

I have not found a consistent method to test for "empty" fields in automation rules, as they are impacted by the field type and starting conditions, such as:

  • field is empty
  • field is blank
  • field was not empty, and now is empty
  • field was not blank, and now is blank
  • field is a type which is never empty; i.e., it always "exists" even when there is no "value"

As others describe, try writing these to the audit log to learn how to detect empty or not:

forms.size = -->{{forms.size}}<--

forms.last.c4p4-brand = -->{{forms.last.c4p4-brand}}<--

forms.last.c4p4-brand.isEmpty() = -->{{forms.last.c4p4-brand.isEmpty}}<--

forms.last.c4p4-brand.isNotEmpty() = -->{{forms.last.c4p4-brand.isNotEmpty}}<--

forms.last.c4p4-brand.length() = -->{{forms.last.c4p4-brand.length()}}<--

exists(forms.last.c4p4-brand) = -->{{if(exists(forms.last.c4p4-brand), "it exists", "it does not exist")}}<--

and so on...

 

Kind regards,
Bill

Like # people like this
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.
December 6, 2024
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 6, 2024

I just saw that yesterday, but have not read through it yet. Will try to do that over the weekend. Thanks for sharing it here. 

Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 7, 2024

Excellent article and love the new capabilities! Thanks for sharing @Bill Sheboy 

Like # people like this
0 votes
Answer accepted
Dirk Ronsmans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 3, 2024

@John Funk ,

You would need to define what form on the issue to get the value from.

https://support.atlassian.com/jira-service-management-cloud/docs/access-smart-values-for-forms-and-form-fields/

For example the last submitted one would be {{forms.last.c4p4-brand}} and it can only trigger on the Form Submitted trigger (or a manual but then you need the uuid of the form template)

Easiest would be to first output the smartvalue through a log action.

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 3, 2024

There's only one form and that syntax works if I am just copying the value of that field over to another Jira field using automation. So I don't think it's form name kind of thing.  But I will give it a try!

Dirk Ronsmans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 3, 2024

If you output the smartvalue to the log how does it show? Cause that might also give us a clue on how to validate it.

Depending on the type of field it could be "empty" but that doesn't mean it's actually empty in the database.

Like # people like this
Mauricio Heberle
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.
December 3, 2024

I tested with forms.last.keyvalue comparing with "Condition equals Empty" and it worked.

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 5, 2024

I was able to shirt it to a different field and base it on an actual value, which worked. I tried all kinds of combinations with the blank/empty value and nothing ever worked for me. But I am able to get it to run now. Thanks for the help!

Like Mauricio Heberle likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events