Compile comment field only with certain text strings and only if certain values are present

Gerardo Dalena May 25, 2021

Hello,

I’m struggling with an issue but unfortunately I can’t find some documentation on it. We have several custom cascading fields that needs to be filled by the agents; the fathers of these fields (the first choice of the cascading) have values YES and NO. We need to fill a comment with the name of these custom fields ({{issue.[Custom Field].name}}) only if the father have value YES. An example:

  • Field 1: YES
  • Field 2: NO
  • Field 3: YES

Desired comment: Field 1, Field 3

The desired comment must be sent via mail with automation for Jira, but that is not the hard part. The problem here is to obtain this “desired comment”.

Any tip is appreciate.

Thanks!

1 answer

1 accepted

1 vote
Answer accepted
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.
May 25, 2021

Hi @Gerardo Dalena 

According to this post, you can do that with an advanced compare condition:

https://community.atlassian.com/t5/Jira-questions/Auto-Assign-Based-on-Multiple-CF-values/qaq-p/927398

Here is the related information on the JSON fields to support this:

https://support.atlassian.com/jira-software-cloud/docs/advanced-field-editing-json/#Advancedfieldediting-JSON--Cascadingselectcustomfield

There is an open suggestion in the Code Barrel (automation) backlog to add support for directly accessing the cascading fields in the condition compare.

Best regards,

Bill

Simmo
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 25, 2021

Hi @Gerardo Dalena,

Bill is correct, the way that you'll need to do this is via the advanced condition. This will allow you to use smart values to access the cascading field.

Cheers,

Simeon.

Gerardo Dalena May 26, 2021

Hello,

thanks for all the tips.

The "desired comment" is made of all the fields that have YES as the parent. So, if I understand right, with 3 fields I have to create an if/else construct with all the possible outcome (YYY,YYN,YNY, etc). Is there a way to avoid this construct? It could be useful for larger group fields (es. 10 possibile fields with Y or N values).

Thanks.

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.
May 26, 2021

Probably yes, and perhaps not, depending upon the format/content you want in the comment...

Please identify an example issue with the values you care about in the field(s), and then use the method described here to learn what the smart value/JSON structure is:

https://support.atlassian.com/jira-software-cloud/docs/find-the-smart-value-for-a-field/

Then construct your comment to indicate all values, if they are indeed accessible this way.

@Simmo -- could that work?

Thanks!

Simmo
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 26, 2021

Hi @Gerardo Dalena

Ultimately, I think you need one of our backlog items https://codebarrel.atlassian.net/browse/AUT-1241 which would allow you to filter items out of a list. That might make things easier here. 

However, I'm afraid that, yes, you'll need all the combinations. Or, a custom field.

If you had a field you could update then you can just check each field and, if it is yes, add it to the custom field so that you build up your value. That would only require 3 if statements then (separate if blocks though, not if / else if). You could also use entity properties and a refetch statement to achieve this as well.

Cheers,

Simeon.

Like Bill Sheboy likes this
Gerardo Dalena May 27, 2021

Hello Bill and Simeon,

thank you very much for your support.

Best regards,

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer