Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira Automation - How to condition values API body related to checkbox customfield

Cedric Devaux
Contributor
October 23, 2024

Hello community,

I connected a Jira project to Status Page to trigger incidents automatically in StatusPage when a major incident is declared.

In jira, I have a transition screen with a checkbox field to indicate the impacted services ex: Data Warehouse, Security, Logistics When a jira incident is declared as major, an automation is triggered to create an incident via an API call in StatusPage.

I've created components in statusPage based on impacted services corresponding to the values in jira's impacted services field.

The automatic creation of the StatusPage incident by API works very well, for the moment I hard-code StatusPage components ID in the body of creation incident API call.

The next step is to be able to condition the list of StatusPage components according to the values ticked in the Jira ticket... And I don't know how to do that.

How to indicate the value of the jira field to select the StatusPage component IDs.

Examples: If I select checkbox values Security and  Logistics in the checkbox, I want a Automation to select only the 2 statuspage compoents IDs.

If I select only DataWarehouse in the checkbox, Automation will use the Datawarehouse ID component.

 

So my question is how to condition smartvalues to get statuspage component ID related to values selected in the checkbox in order to send incidents with corresponding impacted components ?

I hope explanation of my qestion is clear ^^

 

Thank you!

 

Cedric

2 answers

1 accepted

0 votes
Answer accepted
Cedric Devaux
Contributor
November 6, 2024

Hi @Bill Sheboy 

Finally if find the solution with a loop to get all value selected by user then changes by statuspage component ids here my example:

1. I create a variable "componentids" to get values from selected list with this rules

{{#issue.customfield_10123}}

    {{#if(equals(value, "value1"))}}"componentid1"{{/}}

    {{#if(equals(value, "value2"))}}"componentid2"{{/}}

    {{#if(equals(value, "value3"))}}"componentid3"{{/}}

     {{#if(equals(value, "value4"))}}"componentid4"{{/}}

    {{^last}}, {{/}}

{{/issue.customfield_10672}}

If user select value1 + value 2 the result is "componentid1","componentid2"

2. I send a webrequest api to status page to create a incident and select good components impacted by incident.

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.
November 6, 2024

Thanks for the information, @Cedric Devaux 

Just to confirm, did this solve the question you originally asked?

0 votes
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.
October 23, 2024

Hi @Cedric Devaux 

For a question like this, please post an image of your complete automation rule, images of any relevant actions / conditions / branches, an image of the audit log details showing the rule execution, and explain what is not working as expected. Those will provide context for the community to offer ideas. Thanks!

Until we see those...

If you are calling the REST API endpoint and want to translate the values from a Jira multiple-select option field to your request component ID values, I suspect you would use list iteration to build the JSON message, perhaps with conditional logic to translate the values to the IDs

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-lists/#Combined-function-examples

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-conditional-logic/

https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/

Kind regards,
Bill

Suggest an answer

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

Atlassian Community Events