Forums

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

Unable to pass webresponse/variables outside if/else block

Scott Lai February 16, 2023

Hi Dear friends,

I am using Jira automation, we are sending REST requests to our app endpoints. I asked a question here: https://community.atlassian.com/t5/Jira-Software-questions/Can-I-get-the-Jira-automation-execution-log/qaq-p/2270732#U2270777

 

After I add "log action." to analyze, I found that the error in our rule is due to the POST response (webResponse) can't be carried outside an if/else block. So we always got the response from previous POST, which is not right.

I even used a variable to carry the response outside, but even the variable also will become empty after it comes out from a condition block.

I understand that jira automation may not be so good for programming ;-). But our managers are urging me to automate everything that can be automated, so I have this question.

 

Can anyone can give me even a workaround?

Thanks,

Scott,

 

1 answer

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.
February 20, 2023

Hi @Scott Lai 

Would you please post images of your rule and the audit log details?  Those may provide context for what you are observing.  Thanks!

Until we see those...

One work-around would be to define a created variable before the if/else block, let's name it varResponse.  Inside of the block, re-define it with the same name, and setting the value to the REST API response.  That should preserve the value, although it will become text and lose the ability for JSON parsing.  And...the work-around for that would be to use iterators; smart value, list filtering; and text functions to access the data.

Kind regards,
Bill

Scott Lai February 22, 2023

Thanks, Bill. But I need to get a json response. No worries, I solved it but creating two active rules and utilize condition in each rule as the first level if/else.

Thanks a lot for your help.

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events