Forums

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

Why does a created variable work in automation but then suddenly stop working in web request?

Lazaros _Lasse_ Lazarou January 22, 2025

 

 

Hi,

I've been struggling with an automation rule for a couple of days now. Most of it works but creating a variable and succesfully using it as a smart value has some unexpected outcomes.

Everything works until the action "And: Send web request" (see below screenshot). In that action I'm referencing a variable created earlier: {{issueOriginalReporter.urlEncode}} but this variable is always empty, which messes up the web request response etc.

The variable issueOriginalReporter is created and works for a while, as the action (see below screenshot) "And: Add value to the audit log." correctly displays an email address in the audit log. For some reason referencing the same variable again in the next action just returns an empty string or null. Why is this? I've tried using the variable in the web request action's body (custom body) by itself and with several different encoding methods. Nothing works.


 

image.png


1 answer

0 votes
Lindsay Bolan January 22, 2025

Have you tried not using the urlEncode modifier? I ran into this same problem of variable value disappearing on the "Send web request" step, and switching from {{issue.cusomfield_xxx.urlEncode}} to just plain {{issue.customfield_xxx}} worked. Happened with both integer and string type variables, and removing urlEncode worked for both. It's not clear why urlEncode doesn't work.

Lazaros _Lasse_ Lazarou January 24, 2025

Hi Lindsay and thanks for the suggestions!

Here's some more testing I did.

The regexp I'm using, visible in my original post works, I've verified that several times with log actions. It succesfully captures an email address from the incoming email's subject line. A custom variable is also succesfully created and used (see picture). So we know the custom variable issueOriginalReporter is not empty when entering the web request part of my automation.

Here I used a test email with FROM(test.address@example.com) in the subject line:

  • Testing custom variable {{issueOriginalReporter}} output BEFORE sending a web request with that variable:
    • {{issueOriginalReporter}} = test.address@example.com
    • {{issueOriginalReporter.urlEncode}} = test.address%40example.com
    • {{issueOriginalReporter.get(1-3)}} = ,,,

The variable itself seems OK (just triple-checking here). Let's move on to the web request part:

Lazaros _Lasse_ Lazarou January 24, 2025

Well now I feel silly. After some more testing it turns out I didn't quite understand that using a custom variable created in an automation ofcourse isn't possible in the web request validation view, when editing said automation. The variable hasn't been created in that context yet, so how could it be available. Turns out I had an issue in the web request body I was using earlier. Using the custom variable directly in the web request URL without a custom body works fine now, when the whole automation runs.

Suggest an answer

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

Atlassian Community Events