How do I get results from searchIssues and use the returned values in a callRest()?

Drew
Contributor
November 8, 2023

I'm trying to use a JQL filter to find a list of issues, and then include that information in the text of a call to an incoming webhook in Teams. I'm struggling with passing around the information/doing things correctly. I currently am doing this in Jira's automations, but would prefer to use JMWE going forward.

I have the query that finds the issue, and I have an idea of how I will be using callRest, but I'm not sure how I would take the results of the search and loop through them in the "text" section in the call to the webhook... any pointers would be appreciated!

{{ "project = \"Tech Support\" AND statusCategory != Done AND \"EquipmentOptions[Checkboxes]\" in (Laptop) AND \"Equipment Shipped?[Checkboxes]\" is EMPTY" | searchIssues(100, fields="url,summary") | }}


{{ "insertWeebookURLHere" | callRest(
verb="post",
body={
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"themeColor": "0076D7",
"summary": "A New Laptop has been Requested!",
"sections": [{
"activityTitle": "There are currently " + issueLookupSizeHere + " in the queue that require a laptop to be shipped out:",
"text": "",
"markdown": true
}]
}
) }}

1 answer

1 accepted

0 votes
Answer accepted
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 8, 2023

Hi @Drew 

You just need to replace the first part with:

{%set issueLookupSizeHere = "project = \"Tech Support\" AND statusCategory != Done AND \"EquipmentOptions[Checkboxes]\" in (Laptop) AND \"Equipment Shipped?[Checkboxes]\" is EMPTY" | searchIssues(100, fields="summary") | length %}
Drew
Contributor
November 10, 2023

Hey David,

Thanks for the reply, that did work for me! I'm new to using nunjucks and JWME so I'm still getting the hang of it. Ultimately I was able to accomplish everything I wanted to, and this helped me get there. Much appreciated!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events