I want to write a JPD automation that checks if multiple fields are empty; and then adds a comment indicating such.
Example:
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.
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
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
@Bill Sheboy Do you know how can get the name of the field?
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
Yeah, I came to the same conclusion. Only the API call will get me the name.
Thanks for the confirmation!
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.