Skip to main content

Notifications

Copilot Studio - General
Answered

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

Like (1) ShareShare
ReportReport
Posted on 2 Oct 2024 12:29:56 by 34
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:
  • Vinoth Selvam Profile Picture
    Vinoth Selvam 1,289 on 04 Oct 2024 at 13:46:17
    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 64,290 on 02 Oct 2024 at 14:10:06
    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 64,290 on 02 Oct 2024 at 13:43:45
    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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #9 Get Recognized…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 144,238

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,290

Leaderboard
Loading complete