Skip to main content

Notifications

Copilot Studio - General
Answered

Using a global variable in the body of a http request in copilot studios

Posted on by 28
I'm making a http request to change a users password. I'm trying to set the password to a global variable that has been previously set within the flow.
 
I've tried multiple methods, listed below with the results, but nothing has worked. I have set my body to formula.
 
Method 1:
{
  password: Global.password
}
 
Got a 400 for this
 
Method 2:
{
  password: "Global.password"
}
 
This set the password to the variable name and not the variable value.
 
Method 3 (Suggested by Copilot AI):
{
  password: "{{Global.password}}"
}
Again set the password to everything within the " " and not the actual variable value.
Categories:
  • VinothSelvam Profile Picture
    VinothSelvam 18 on at
    Using a global variable in the body of a http request in copilot studios
    Please use the PowerFx expression in your case:
     
    Concatenate("{'password':", Global.password, "}")
  • Verified answer
    Pstork1 Profile Picture
    Pstork1 63,414 on at
    Using a global variable in the body of a http request in copilot studios
    Sorry, previous answer was for Power Automate, which you could use inside Copilot studio to do the call. If you want to do it using advanced try setting the body to raw and use the following Power FX formula
     
    Concatenate("{'password':", Global.password, "}")
  • Suggested answer
    Pstork1 Profile Picture
    Pstork1 63,414 on at
    Using a global variable in the body of a http request in copilot studios
    You need to insert the password using the dynamic content dialog and selecting the variable from the list. The result should look something like this.  The JSON for the variable is variables('password') if password is the name of the variable.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

September 2024 Newsletter…

September 2024 Community Newsletter…

Community Update Sept 16…

Power Platform Community Update…

Welcome to the new Power Platform Community!…

We are excited to announce our new Copilot Cookbook Gallery in the Community…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 141,122

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,414

Leaderboard