web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Optionset in User defi...
Power Apps
Suggested Answer

Optionset in User defined Types

(3) ShareShare
ReportReport
Posted on by 48
In User-defined Types:
 
Is there a way to define a User-defined Type for option set. I have tried defining the "OptionSet" or using "UntypedObject"  itself.  Using the optionset is invalid syntax and using "UntypedObject" is giving error
 
"Incompatible type. The 'TaskStatusCR' column in the data source you’re updating expects a 'UntypedObject' type and you’re using a 'OptionSetValue (RequestStatus (Client Requests))' type"
 
ColTaskType := Type({
    TaskStatusCR: (RequestStatus (Client Requests)),
    TaskStatusPTD: UntypedObject
})

 
Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,963 Moderator on at
     
    What are you trying to do this in? Is this a PCF control or?
  • stampcoin Profile Picture
    5,166 Super User 2026 Season 1 on at
    Hi @deseye,
    Type is experimental feature...
    Did you consider using clearcollect function, or combine set() ?
  • ronaldwalcott Profile Picture
    3,906 Moderator on at
    Why would you try to create a user defined type for an option set. How is this option set going to be used? 
  • deseye Profile Picture
    48 on at
     
    thanks for your responses.
     

    Currently, I use a button to trigger an operation, but I want to replace this with a user-defined function instead of relying on Select(Button).

     

    Inside the button’s logic, I use Gallery.Selected to extract a record from the gallery and perform some operations on it.

     

    However, when attempting to replace the button with a user-defined function, I need to pass Gallery.Selected as an argument. The challenge is that my function requires a user-defined type for the argument, but since the collection is a manipulated version of multiple data sources, it does not directly match any existing entity schema.

     

    How can I properly define the function argument type to match my transformed collection structure?

     

     
  • ronaldwalcott Profile Picture
    3,906 Moderator on at
    Sorry but you would have to provide way more details than that to expect any feedback which could help.
    Are you essentially trying to create dynamic collections with unknown types at runtime? 
  • stampcoin Profile Picture
    5,166 Super User 2026 Season 1 on at
    Hi @deseye,
    since not much info from you project. I try my best:
    Have you tried use it in App.Formulas ?
    see below code.
    TaskStatusCRType := Type({
        RequestStatus: Text,
        ClientRequests: Text
    });
    TaskStatusPTDType := Type({
        Property1: Text,
        Property2: Text
    });
    ColTaskType := Type({
        TaskStatusCR: TaskStatusCRType,
        TaskStatusPTD: TaskStatusPTDType
    });
    if that works, then you use ParseJSON for the next action.
    my point is construct your data as JSON, then you can utilize ParseJSON,
     
    
    OtherType= ParseJSON( Tasks, ColTaskType)
    AddColumns(OtherType, isTaskClosed, True)
    please read this article user defined types
     
     
  • Suggested answer
    w.p Profile Picture
    8,345 Super User 2026 Season 1 on at
    ColTaskType := Type( 
        {
            TaskStatusCR: fxTaskStatusCR,
            TaskStatusPTD: UntypedObject
        } 
    );
    fxTaskStatusCR := Type( 
        {
            val1: Text,
            val2: Text,
            val3: Text
        } 
    );
     

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 426

#2
WarrenBelz Profile Picture

WarrenBelz 381 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 315 Super User 2026 Season 1

Last 30 days Overall leaderboard