Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Not able to retrieve fields within webresponse using smart values

Hi,

I'm trying to use a smart value to extract the value field in the fourth element of an array from a web response, but I haven't been successful. Can someone please help me identify what I'm missing?

So far, I have tried {{webResponse.body.custom_fields.get(3).value}}, {{#webResponse.body.custom_fields}}{{#if(equals(name,"resolution_note"))}}{{value}}{{/}}{{/}} and few other things but no luck.

jira automation.jpg

2 answers

Thanks Bill for the reply.

Yes, I am try to do this in Jira Automation.

I am making an external API call from Jira Automation and using the API response to set the value of one of Jira custom fields

I can capture the entire response in the log action using {{webResponse.body}} but having hard time parsing the Json.

Any idea how can I convert array into list in Jira Automation?

 

image.png

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.
Oct 09, 2023

Hi @Dharmesh Patel -- Welcome to the Atlassian Community!

Context is important for a question like this...

Are you doing this in an automation for Jira rule?  If so, please post an image of your complete rule, images of any relevant actions, and an image of the audit log details showing the rule execution.

Until we see those...

Have to tried writing the entire web response to the audit log to confirm it matches what you expect in your parsing attempts?

Next...Those square brackets tell me response's custom_fields attribute may contain an array, and not a list.  And so that cannot be parsed with get() until it is converted to a list.

Kind regards,
Bill

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.
Oct 09, 2023

Please try sticking to one conversation thread; that will help others looking at this question to learn if there are multiple possible answers.  Thanks!

Why are you using a REST API call to set a custom field?  Are you updating issues in another Jira instance / site?

Again, would you please post an image of your entire rule?  The audit log is helpful but it does not show all possible things which happen for a rule execution.

I can't paste the rule, have some sensitive info in it.

I need to call an external provider API to fetch some data and then use that data to set the custom field with in Jira. I basically need to map the fields between the two solutions.

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.
Oct 09, 2023

No worries on seeing the rule.  You may want to review it with a colleague to confirm it works as you planned.

Did you note my comment about arrays versus lists?  That response cannot be parsed as a list and so instead you may need to either:

  • modify your call to the external provider to only return the record needed, and/or
  • use text functions of rules to extract what is needed
  • attempt to split the array into a list, and then parse the fields using text functions

Suggest an answer

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

Atlassian Community Events