Skip to main content
Community site session details

Community site session details

Session Id : lx+2Eak/GlX7Bv9NrCC70B
Copilot Studio - General
Answered

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

Like (1) ShareShare
ReportReport
Posted on 3 Jan 2020 05:23:40 by 12

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?

  • ankit3 Profile Picture
    12 on 07 May 2020 at 01:01:32
    Re: How to set a variable as Null if the user does not provide any value

    Can you post a video please?

  • ankit3 Profile Picture
    12 on 14 Apr 2020 at 00:43:49
    Re: How to set a variable as Null if the user does not provide any value

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

  • dougmaloney Profile Picture
    59 on 13 Apr 2020 at 02:50:28
    Re: How to set a variable as Null if the user does not provide any value

    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.

  • ankit3 Profile Picture
    12 on 09 Apr 2020 at 01:44:08
    Re: How to set a variable as Null if the user does not provide any value

     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.

  • dougmaloney Profile Picture
    59 on 09 Apr 2020 at 01:38:42
    Re: How to set a variable as Null if the user does not provide any value

    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. 

     

  • ankit3 Profile Picture
    12 on 05 Jan 2020 at 22:22:08
    Re: How to set a variable as Null if the user does not provide any value

    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?

     

     
  • Verified answer
    Ashish2012 Profile Picture
    478 on 03 Jan 2020 at 21:38:35
  • CU22081450-0 Profile Picture
    Most Valuable Professional on 03 Jan 2020 at 09:59:14
    Re: How to set a variable as Null if the user does not provide any value

    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-empty-string/m-p/430063#M475

    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!"

     

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Copilot Studio

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 169 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 150

#3
sandeep_angara Profile Picture

sandeep_angara 75 Super User 2025 Season 2

Loading complete