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 / Error: Variable is bei...
Copilot Studio
Suggested Answer

Error: Variable is being set to incorrect type but error shows correct type?

(2) ShareShare
ReportReport
Posted on by 24
Error: Variable is being set to incorrect type. Assigned: Closed List Option Set, Expected: Closed List Option Set
 
I have hit a roadblock when attempting to assign a global variable with a local variable value inside one of my topics. Searching the web has produced users with similar issues but no working resolution path so far.
 
Scenario:
 
The topic uses the States entity to extract what state the user is referring to in a dialog prompt. A conditional statement then filters based on the state selected. 
 
Branch 1
If State = ABC display choices from 'CustomEntityClosedListABC' save user choice as 'LocalVariableABC' Confirm selection with user, save 'GlobalVariable' as 'LocalVariableABC' This path is working as intended with no errors
 
Branch 2
If State = XYZ display choices from 'CustomEntityClosedListXYZ' save user choice as 'LocalVariableXYZ' Confirm selection with user, save 'GlobalVariable' as 'LocalVariableXYZ' This path produced the error (screenshot below)
 
I have tried a few options such as recreated the entities, creating new variables, setting variable types prior to the conditional path, cutting out the local variable and saving the choice direct to the global, etc. If I try to use the GlobalVariable anywhere else besides the first path of a conditional I receive this error.
 
Solution Needed: A way to filter by state to direct bot to use state specific customentity list and then save that choice both in a topic variable and again in a global variable for a future topic
 
I have the same question (0)
  • Suggested answer
    Inogic Profile Picture
    1,135 Super User 2025 Season 2 on at
    Hi,
     

    What's Causing the Problem:

    You are using multiple drop-down lists (choices) in your bot for different states like ABC and XYZ.
    Even though these look like regular choices to the user, behind the scenes each choice list is a different “type”, and Power Virtual Agents doesn’t allow mixing them.
    So, when you try to save a value from one list into a variable meant for another list, the bot gives an error even though they both look like "choices".

    Simple Solution That Works:

    We will save the selected value as plain text (just the label) instead of saving it as a “choice” type.
    This way, you can use that text anywhere, no matter where it came from.

    How to Fix It Step-by-Step:

    1. Change your Global Variable to Text type
    • Go to your Global Variables
    • Find Global.Agency_Name
    • Change its type from Choice to Text
    1. When user picks from a choice list (like CustomEntityClosedListABC):
    • Save the selected option label (not the whole choice) to a text variable, e.g. VarABC_Text
    1. Assign the local text variable to the global one:
    • Set Global.Agency_Name = VarABC_Text
    This will now work with any choice list, because you're only dealing with text, not the special "choice object" types.

    Example:

    If State = ABC:

    • Show drop-down from CustomEntityClosedListABC
    • Save label of selected item to: LocalChoiceABC_Text
    • Then: Set Global.Agency_Name = LocalChoiceABC_Text

    If State = XYZ:

    • Show drop-down from CustomEntityClosedListXYZ
    • Save label of selected item to: LocalChoiceXYZ_Text
    • Then: Set Global.Agency_Name = LocalChoiceXYZ_Text
    Hope this helps.

    Thanks!
    Inogic

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 261 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

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

#3
S-Venkadesh Profile Picture

S-Venkadesh 93 Moderator

Last 30 days Overall leaderboard