indexOf smart value

Jordi Romera April 24, 2024

I am using an automation where the user chooses the option to delete in a select list custom field.

I need the indexOf function to find the value selected by the user (A, B, C or AA), which I store in the variable userInputs.deleteOption, in this json: {id=14928, value=A, disabled=false}, {id=14929, value=B, disabled=false}, {id=14930, value=C, disabled=false}, {id=14937, value=AA, disabled=false}, {id=14941, value=BB, disabled=false}.

I have used the smart value indexOf so {{json.indexOf("chain")}} where the variable chain = , value={{userInputs.deleteOption}},

The result of this smart value is -1.

Can someone give me a hand?

Thank you very much.

Translated with www.DeepL.com/Translator (free version)

2 answers

1 accepted

0 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.
April 25, 2024

Hi @Jordi Romera 

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

Is your manually triggered rule providing a user input field, which you are then trying to search for in the content of another field / smart value expression?

If so, please try this, assuming you are searching in the Description field:

{{issue.description.indexOf(userInputs.yourInputVariable)}}

 

Kind regards,
Bill

0 votes
Jordi Romera April 26, 2024

Thank you Bill. I have found this workaround from Atlassian: https://confluence.atlassian.com/jirakb/querying-json-data-in-jira-automation-1319570559.html

Regards,
Jordi

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.
April 26, 2024

Thanks for that link, Jordi.  I suspect the limitation is for JSON data which is not for an issue...or more specifically, which cannot be iterated over as a list with attributes.

Another workaround would be to use a dynamic regular expression with the match() function.

Like Jordi Romera likes this

Suggest an answer

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

Atlassian Community Events