web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / Power Virtual Agents: ...
Copilot Studio
Unanswered

Power Virtual Agents: Creating Variables for the bot

(0) ShareShare
ReportReport
Posted on by 40

Hello Community,

 

When creating variables in Power Virtual Agents, it looks like we would always have to start with a question before we would get the option to create a variable. Is there a way we could create the bot variables outside of a question/node? the issue for creating the variable in a question is that if we delete the question node then we would lose the variable. How can we create a variable and keep it to use for a bot topic, without having to associate the variable with any particular question or node?

 

Thanks.

Categories:
I have the same question (0)
  • HenryJammes Profile Picture
    on at

    Hi @D365EL,

     

    In the unified authoring canvas, you can define and manipulate variables directly in the topic canvas.

    Work with chatbot variables - Power Virtual Agents | Microsoft Learn

     

    In the classic version, outside of question nodes, you can initialize and update variables using the Bot Framework Composer.  See an example of how to initialize and how to update a PVA variable with BFC here: Solved: Re: Integrate a PVA chatbot with Azure OpenAI Chat... - Power Platform Community (microsoft.com)

     

    Henry

  • D365EL Profile Picture
    40 on at

    Hi @HenryJammes , thanks for the info. So using the unified authoring topic canvas, I see we can create a new variable using the variable management option in my screen shot below, and select Set a variable value, then create the new variable:

     

    D365EL_0-1686241265827.png

    D365EL_1-1686241348954.png

    In this scenario, I want to create a global variable that is going to be set by an external source. I defined the variable as below. So in this case, do I simply leave the "To value" field blank? because it's going to be set by an external source, so I am not setting any value here. If this "To value" is required to be populated, what and how should I populate this since this is going to be set by an external source? Am I doing this right?

    D365EL_3-1686241445692.png

     

    Please advise, thank you!

     

  • HenryJammes Profile Picture
    on at

    Good question, I don't know if you can leave it undefined or if you shouldn't set it to a blank value (="")

  • D365EL Profile Picture
    40 on at

    Hi @HenryJammes , but if we set it to a blank value, I am worried if it's going to overwrite what the external source would be setting this variable. Essentially what I am looking to do is to create a global variable to be used by this topic, and this global variable would be set by an external source... 

     

    Is that the right area to create new variables outside of any given node - just wanted to make sure I got this part right when you said I could create variables within the topic canvas

  • HenryJammes Profile Picture
    on at

    @CleberM maybe that's something you know for OC + PVA unified canvas integration?

  • Robulane Profile Picture
    on at

    Hi,


    This is something we are working on. As a temporary solution, @D365EL you can create a separate topic without trigger queries and put "Set a variable value" nodes there. You can put any value of the variable here as they won't be used, however it is important to assign the value of the correct type. E.g. if your external variable is number, please assign 0, if your external variable is string, assign an empty string. This is needed for PVA to correctly identify the type of the variable. As the topic won't be triggered, the actual values don't matter.

  • D365EL Profile Picture
    40 on at

    @Robulane , that's a great idea, thank you!

  • D365EL Profile Picture
    40 on at

    @Robulane , if you don't mind me asking, what's the syntax for setting an empty string in that value field? 

  • Robulane Profile Picture
    on at

    Robulane_0-1686293844917.png

     

  • D365EL Profile Picture
    40 on at

    Thank you @HenryJammes!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Copilot Studio

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 251 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 201 Super User 2025 Season 2

#3
S-Venkadesh Profile Picture

S-Venkadesh 93 Moderator

Last 30 days Overall leaderboard