Automation that reviews if multiple fields are empty and adds comment indicating specific fields

Tyler Flores
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 18, 2024

I want to write a JPD automation that checks if multiple fields are empty; and then adds a comment indicating such. 

 

Example:

  • Field 1: Dummy data
  • Field 2: "Empty"
  • Field 3: "Empty"
  • Field 4: Dummy data

 

In this instance, the comment should indicate that Fields 2 & 3 are empty and need to be populated. I know I can add automations for each field and have separate comments for each one but wanted to see if it was possible to consolidate into a single comment. 

 

2 answers

1 vote
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.
June 18, 2024

Hi @Tyler Flores -- Welcome to the Atlassian Community!

Yes, that is possible, although there is no single "walk over all fields to look for empty" technique that I am aware of.

You could do this inline as the comment is created, testing each field of interest.  Or, use conditions and created variables to build-up what you want to post in the comment later in the rule.

As with many things automation-related, the details are important.  Different field types require different techniques to detect "empty", so experimentation may be required.

Kind regards,
Bill

Tyler Flores
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 20, 2024

These fields are custom basic single-select dropdown so I don't think the detection part is too difficult. 

 

What I don't know how to do is "You could do this inline as the comment is created, testing each field of interest.  Or, use conditions and created variables to build-up what you want to post in the comment later in the rule."

 

What is the syntax to do this within the Action of Adding a Comment? Or would creating the variable be a better solution? 

0 votes
Aaron Pavez _ServiceRocket_
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.
June 18, 2024

Hi @Tyler Flores 

The automation with the comment is doable.

When : For example lets use manual trigger for now

IF -Issue fields condition: custom field is empty

Then: add comment issue

use: smart value {{issue.fields.customfield_xxxxx.name}} -> but this one doesn't work at all in Jira cloud.

I was trying to do this, but it seems none of these works to get the custom field name:

  • {{issue.fields.customfield_xxxxx}}
  • {{issue.fields.customfield_xxxxx.name}}
  • {{issue.fields.my custom field}}
  • {{issue.fields.my custom field.name}}

@Bill Sheboy Do you know how can get the name of the field?

Regards

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.
June 18, 2024

Hi @Aaron Pavez _ServiceRocket_ 

I recall seeing another post about getting custom field names in rules, and my experiments showed:

The {{issue.customfield_12345.name}} does not return the name for Jira Cloud, even though the docs indicate it does: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues.

I was able to get the name using a Send Web Request action calling the REST API with the expand=names parameter and then parsing the value from the names attribute: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

Kind regards,
Bill

Aaron Pavez _ServiceRocket_
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.
June 19, 2024

Hi!

Yeah, I came to the same conclusion. Only the API call will get me the name.

Thanks for the confirmation!

Regards

 

Like Bill Sheboy likes this
Tyler Flores
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 20, 2024

Hi Aaron, from what you're proposing - it sounds like it would add a new comment for each empty field correct? Is there a way to consolidate? 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events