cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

How to set a variable as Null if the user does not provide any value

Hi,

 

I have made a bot that asks a bunch of questions and then using the variables calls flow to send an email. The problem is that some variables are optional for the user (the chat flow is made like that) and when some variables are not provided, the flow call is executed and the questions are asked again.

 

Is there any way to assign variable a null value?

1 ACCEPTED SOLUTION
8 REPLIES 8
Super User
Super User

Hi @ankit3 ,

 

Can you take some pictures of your scenario?

 

But side your pictures, you can see if this topic help you: https://powerusers.microsoft.com/t5/Power-Virtual-Agents-Forum/Conditition-to-test-a-variable-for-an...

The solution is: "[...] are you trying to handle a return variable from a flow and do a condition in PVA based on that? I had the same issue and I had to add some logic in the flow to set the value of the variable to "NotFound" and then pass that back into the PVA so that the condition had something to select. Yes i know, workaround to fix a simple feature gap but you know... Let's be agile!"

 


Did I answer your question? Mark my post as a solution!
Thanks!

Renato Romão,

Connect with me here 😉

Power Virtual Agents course (+2.250 students | PROMOTIONS) : English | Português

Thanks for your reply.

 

Attaching screenshot of the PVA where I'm calling flow. You can see there are around 8 variables. The flow is executed perfectly if all 8 all present but of user chooses not to provide the "CompanyName", the flow is not executed and user is asked to provide "CompanyName" again. What I'm asking is that, is there any way I can identify if a variable is empty and if yes, assign "Null" to it so that flow can be executed?

 

 

Did you find a solution for this ? I have the same problem.

 

  1. Prompt the user "Were you born in Australia or Overseas" (multiple choice).
  2. If they answer "Overseas" PVA prompts "Please enter the country you were born in" (text).
  3. Call action, passing the variables from both prompts.

If the customer selects "Australia" in the first prompt, it means the  second prompt is not issued, and the resulting variable is not assigned.

 

When I come to call my action in 3, PVA prompts for the missing variable "Please enter the country you were born in" BEFORE calling the action. The receiving action has that variable set as "optional".

 

I've tried a few workarounds including assigning the missing variable using another different action, but I run into the same problem when it returns. 

 

 I haven't found the solution yet. I've reached out to Microsoft team and they suggested to use "Receive request from Power Virtual Agent" in Power Automate but that doesn't work as well. I'll post the solution here once I get the final resolution.

I've found a solution to this which works, but ... It's complicated.

 

I use an Excel online spreadsheet as temporary storage for my variables, keyed off a guid which is generated by an action at the top of the PVA flow.

 

The same action returns a set of default values for the variables which might be unset/null.

 

Every time a question is asked in the PVA flow, I call another action either with the value of the variable OR for all other cases, the default value. This action stores the values in the spreadsheet.

 

At the end of my flow I have yet another action which uses the original guid to retrieve the correct row and values from the spreadsheet. 

 

It took some thought, and some time to setup, but it does work.

If it's going to be helpful I'll post a video of how I did it.

That sounds complex but good. Can you please share a video?

Can you post a video please?

Helpful resources

Announcements
PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Check out Tomasz Poszytek's session from the 2020 Power Platform Community Conference!

PVA Commnity Blog

NEW Power Virtual Agents Community Blog

View articles posted by fellow community members on the Power Virtual Agents Community Blog!

Top Solution Authors
Top Kudoed Authors
Users online (3,680)