Forums

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

How to call variable inside a smart value?

Shruti Shrivastava
January 2, 2024

I am trying to get a particular value in the JSON Response receievd after calling an API. I have to send this value in an email report.

{{webhookResponse.body.sprints.velocityStatEntries.split({{VelocityVariable}}).get(2).substringAfterFirst("value=")}}

where VelocityVariable = {{webhookResponse.body.sprints.id.get(0)}}

Also tried

{{webhookResponse.body.sprints.velocityStatEntries.split(VelocityVariable).get(1).substringBefore(",text")}}

I also tried the follwoing without using a response:

{{webhookResponse.body.sprints.velocityStatEntries.split(webhookResponse.body.sprints.id.get(0)).get(2).substringAfterFirst("value=")}}

2 answers

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 Champions.
January 7, 2024

Hi @Shruti Shrivastava 

First thing, I am using Jira Cloud, free edition, and so cannot test what I suggest with Jira Server.

 

Next, are you certain the smart value velocityStateEntries is populated / available to the automation rule?  You can confirm that by writing the value to the audit log and then testing.

 

Next, splitting on a dynamic delimiter, with a variable, in automation rules is possible.  And one of the syntaxes you tried should work: 

{{someList.split(someVariable)}}

The key is in the details...To understand what is not working, I recommend writing the intermediate values to the audit to log:

  • Write your entire response to the audit log to check the structure matches what you expect
  • Write the extracted delimiter (your VelocityVariable) to the audit log to confirm it contains what you expect.
  • Your rule appears to attempt to split on a sprint id value, which is a number represented as text in the variable.  Is it possible the value will be found in other locations in the text being split?  For example, if the sprint id is "5" and a "5" appears elsewhere the velocityStateEntries than where you expect.
  • For the anticipated result of the split, your expressions are checking with get(1) and get(2).  What if the result does not contain that many list items?

Kind regards,
Bill

0 votes
Shruti Shrivastava
January 4, 2024

@Bill Sheboy Hi Bill,

Can you please help me on this?

Suggest an answer

Log in or Sign up to answer