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

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

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 Leaders.
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 Leaders.
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.

 

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events