Skip to main content

Notifications

Copilot Studio - General
Answered

Referencing a variable that hasn't been populated, forces it to be populated

Posted on by 13

Hello,

I've run into an issue with a condition, where I would like to ask the user a question and then ask them a follow up question if their response is one of two things.

 

Ideally, I would want to be able to save the response to the follow up (in this instance, a custom email address) in the "SendEmail" variable, so that it covers both scenarios. However, this isn't possible so I've had to save it as a separate variable "CustomEmail".

 

The main problem arises when I try to call my Power Automate flow, which is configured to take both of the variables. If the user chooses 'Default', then I would expect the CustomEmail variable to not be populated, which I can handle in the flow. What actually happens, as seen below, is that the bot forces the custom email question on the user even though they chose the 'Default' response.

Surely this isn't intended behaviour?

wturner123_0-1620378363996.png

Categories:
  • Re: Referencing a variable that hasn't been populated, forces it to be populated

    Thanks for trying to help 🙂 In a very convoluted way, we got what we wanted 😄

  • renatoromao Profile Picture
    renatoromao 6,762 on at
    Re: Referencing a variable that hasn't been populated, forces it to be populated

    Great @wturner123 !

    My suggestion is not working because when you use a custom entity with synonymous, you cannot get the whole value entered by user 😞 

  • Verified answer
    wturner123 Profile Picture
    wturner123 13 on at
    Re: Referencing a variable that hasn't been populated, forces it to be populated

    Managed to come up with some sort of solution which seems to work.

     

    By having an open question and asking the user to answer in a particular way, we can then capture the response and validate it in a Power Automate flow. If it's deemed to be invalid, we can loop back until they've entered a valid response.

    wturner123_0-1620400403426.png

     

  • wturner123 Profile Picture
    wturner123 13 on at
    Re: Referencing a variable that hasn't been populated, forces it to be populated

    Thanks for the replies again.

     

    I can't see a way to retrieve the actual email that they've entered though? It correctly matches "Custom", but this is also what is returned.

     

    wturner123_0-1620395193434.png

     

  • renatoromao Profile Picture
    renatoromao 6,762 on at
    Re: Referencing a variable that hasn't been populated, forces it to be populated

    @wturner123 ,

     

    You can do a workaround.

     

    1- Create an entity (left menu) called "Email Type" with:

    - Default

    - Custom (and here, add some synonymous like: "Custom:  user@site.net " " Custom - user_name@mysite.com.eg" "custom user.Name12@website.net" )

     

    and turn on the Smart matching.

     

    2- Go to your topic and modify the question to use the entity instead of fixed options. And a note inside your question for the user like "Note: If you want to use custom email, send Custom - youremail@contoso.com"

     

    3- Create the condition again to guarantee the connection with the new question

     

    3- Remove the Email question

     

    4- In your workflow, remove the CustomEmail parameter

     

    5- Done!

  • Re: Referencing a variable that hasn't been populated, forces it to be populated

    Thanks 🙂 - in other words - we did not miss anything, it is just currently not possible to do. Shame...

  • renatoromao Profile Picture
    renatoromao 6,762 on at
  • wturner123 Profile Picture
    wturner123 13 on at
    Re: Referencing a variable that hasn't been populated, forces it to be populated

    Thanks for the reply.

     

    Unfortunately, this causes so much duplication of code/actions. This is just a sample of the actual topic we have, but essentially the Power Automate flow returns a "JobId" value which is used by several other steps that proceed this in the topic.

     

    By splitting out this part where we call the flow and return a JobId, we'd have to also duplicate everything after that, as we also can't set the same JobId variable globally from two separate topics.

     

    There's a few things that would solve this, which all seem to be unavailable as far as I can tell:

    1. Set the value of a variable without the use of the "Ask a question" action

    2. Passing null values to Power Automate

    3. Re-using variables - i.e. "Ask a question" could update an existing variable, rather than having to declare brand new ones

     

    Keen to know if there's any other solution available that I'm missing.

  • renatoromao Profile Picture
    renatoromao 6,762 on at
    Re: Referencing a variable that hasn't been populated, forces it to be populated

    Hi @wturner123  / @Anonymous ,

     

    Unfortunately, it's not possible to pass an empty variable to your workflow yet.

    We have an idea here: Allow PVA to send 'NULL' values to Power Automate - Power Platform Community (microsoft.com)

     

    My suggestion: Create two different workflows, it's better.

  • Re: Referencing a variable that hasn't been populated, forces it to be populated

    This looks like a pretty big omission, surely this cannot be working as intended 🙂 Help, please 🙂

Helpful resources

Quick Links

Welcome to the Power Platform…

We are thrilled to unveil the newly-launched Power Platform Communities!…

Getting Started…

Welcome to the Power Platform Community! We appreciate your visit…

Welcome to the new Power Platform Community!…

We are excited to announce our new Copilot Cookbook Gallery in the Community…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 138,287

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,172

Leaderboard