Hi,
I'm trying to iterate a list of possible custom field options from the Jira API
rest/api/3/field/customfield_10670/context/11056/option and match one of them against a regex to "select" it.
I can iterate the web response using:
{{#webResponse.body.values}} {{.}} {{/}}
Which gives:
{id=15022, value=AIR service, disabled=false}
{id=15024, value=Analytics Service, disabled=false}
{id=15161, value=Auth Service, disabled=false}
{id=15271, value=Comments and Evidences (CE) Service, disabled=false}
{id=15013, value=Content Service, disabled=false}
{id=15027, value=Control Service, disabled=false}
I want to pull the ID for the value matching "Content". I think I can use match like this from this post but I can't get it to work - I just get null
{{#webResponse.body.values}} {{value.match(".*Content.*")}} {{/}}
What am I missing?
I can't tell if it's the regex or the syntax inside the loop
Are you trying to only match on the value attribute within the values list?
If so, please try this:
{{webResponse.body.values.value.match("(.*Content.*)")}}
If instead you are trying to get the entire record from values where it matches, please try using list filtering on the value attribute to get the record:
{{#webResponse.body.values}}{{#if(exists(value.match("(.*Content.*)")))}}{{.}}{{/}}{{/}}
Kind regards,
Bill
Hi Bill,
Thanks for this - I was looking for the 2nd option, but both examples worked perfectly.
I tweaked this slightly to just return the id
{{#webResponse.body.values}}{{#if(exists(value.match("(.*Content Service.*)")))}}{{id}}{{/}}{{/}}
Next I need to see if I can take that ID and "select" it. Hoping I can do this directly in the "advanced" edit issue, of if not, I'll assign it to a variable and push it that way.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.