I've a dialogue where I run an Action to set the initial context with external data and then I have a loop, where its last step is rebuild the context to be used for the next cycle of the loop:
The problem is that currently there is no way for us to update the Context variable from the beginning of the loop, with the value returned by the RebuilContent Action.
The current behavior is that any Action output is always created as a new variable, not allowing you to update an existing one!
Basically, the only option we've to update the value of an existing variable, is adding a question step, but that required the user to type the value, what is not useful when the value is returned by a Power Automation call (Action).
My request I would like to place, is that should be possible for us to choose to get a new variable automatically created (as is now) or be able manually map the output of the Action to an existing variable (similar to what we do with the inputs).
Thank you very much in advance,
Jose Alves (joseal)
Unfortunately, it's not available yet.
But you can vote in these ideas here: https://powerusers.microsoft.com/t5/Power-Virtual-Agents-Ideas/Allow-Flow-response-messages-to-overw...
The only answer is to use an external store for the data item that needs to be updated. e.g. CDS or Excel
Create an online Excel sheet or CDS which your PA Flow can access with two columns - guid and mydataitem
If you have chosen to use Excel, make these two columns into a table.
At the first entry point to your bot, create a PA Flow which creates a guid (guid() is a function which is available from the Expression builder)
then add a row to the table in your Excel sheet (or into CDS) with the guid and any initial value for mydataitem, or items. Return the guid to the PVA topic.
In the PVA topic, make the guid returned from this PA Flow a global variable, so that any topic in your bot can access it.
Create another PA Flow which accepts the guid as an input, and any other data you want to pass into it. This Flow should get the Excel/CDS row, using the guid as the key, meaning it will also find the value mydataitem for this user/bot session.
You can manipulate the value of the data item(s) as you see fit in this PA flow, using any of the actions available to PA. Store the value back to the same row in the Excel/CDS, again keyed by the guid, and return whatever values to your PVA topic.
Call this Flow from anywhere in your bot, always passing in the bot.guid global variable.
Of course, you can create as many different Flows as you like to access this temporary data store, as long as they use the global bot.guid to access the data for the current session.
When convenient, if there is a common exit point from your bot, have another flow to clean up - deleting the row for the current guid. Or you could run a timed clean up flow every day.
Keep up to date with current events and community announcements in the Power Virtual Agents community.
A great place where you can stay up to date with community calls and interact with the speakers.
Check out the latest Community Blog from the community!