Forums

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

How to compare selected values before customfield update and after customfield update

Cedric Devaux
Contributor
November 6, 2024

Hello community,

 

I have a select list with multiselect value and I need to know from automation rule which values have been deselected by the user after the update.

Because for each deselected values, I want to send a update from api to status page to reset component status

ex: 

Before update customfield "StatusPage" 4 values were selected component1, component2, component3 and component4

After customfield value update  selected values by user are component1 and component2

So at this moment, Automation compares previous values to new values selected and detect component3 and component4 deselected then automation send a webrequest api to statuspage to reset component statuses of component 3 and 4.

 

For the webrequest, I know how to update.

For the moment my issue is to compare old selected values to new selected values and to get which values have been deselected

a loop from all available values from the field to compare old selected values to new selected values

 

For the moment, I create this rule without loop.

Automation rule comparison.png

 

And I think I will have to add additional conditional fro each comparison to be sure that the loop does not stay at the first step of condition and pass all conditions

 

ex

1st loop

Compare if fieldchange.fromstring contains value1 and  fieldchange.fromstring does not contains value1 and comparison = no

 

2nd loop

 

 

Compare if fieldchange.fromstring contains value1 and  fieldchange.fromstring does not contains value1 and comparison = yes

Compare if fieldchange.fromstring contains value2 and  fieldchange.fromstring does not contains value2 and comparison = no

 

loop3

 

Compare if fieldchange.fromstring contains value1 and  fieldchange.fromstring does not contains value1 and comparison = yes

Compare if fieldchange.fromstring contains value2 and  fieldchange.fromstring does not contains value2 and comparison = yes

 

Compare if fieldchange.fromstring contains value3 and  fieldchange.fromstring does not contains value3 and comparison = no

 

 

1 answer

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

Hi @Cedric Devaux 

Have you instead tried using the field change, deleted values, smart values to do this: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--fieldChange--

And, if possible, I recommend making a single call to your REST API endpoint rather than looping to call for each one.

Kind regards,
Bill

Suggest an answer

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

Atlassian Community Events