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:Ā 

Count of specific value in JSON response array

Alex Relton Brown
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!
February 6, 2024

I am attempting to create an email notification that includes the number of failed tests in an Xray Test Execution Issue. (Xray is a test management plug-in for Jira). Unfortunately Xray-specific information such as Test Run results, whilst available in the Jira Issue UI are not part of any accessible Jira custom field.

I have an Automation Component that is sending a web request to the Xray API which returns the required information. I can then drill into that using a smart value that looks like this:

jiraAutomationQuestion.JPG

Is there any way I could I then count the number of 'PASSED's and 'FAILED's?

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

2 votes
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 Champions.
February 6, 2024

Hi @Alex Relton Brown -- Welcome to the Atlassian Community!

Without seeing your complete rule...I suspect you could use the match() function with a regular expression to search the response, producing a list of matches:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#match--

Then using the list function size you would get the count:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-lists/#list.size

Kind regards,
Bill

0 votes
Kalyan Sattaluri
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 Champions.
February 6, 2024

Hello @Alex Relton Brown  welcome to the community.

Can you share what do your raw response look like, screenshot is not JSON.

 

 

TAGS
AUG Leaders

Atlassian Community Events