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 / Power Apps / When patching a record...
Power Apps
Answered

When patching a record, Optionset failed to find OptionsetValue in the Power Fx formula

(0) ShareShare
ReportReport
Posted on by 55

In my Appointment entity, we have 2 custom fields named "Interview Type" & "Interview Type Global".  The Label and Value of both optionset/choice fields are completely the same as "Individual" (740110000) & "Group" (740110001).  The only difference is one is a local choice, the other one is a global choice named "Interview Type":

daniuosagi_0-1632275781404.png      daniuosagi_1-1632275818575.png

When I tried to create an Appointment record with the "Interview Type" field set as "Individual", it's patched like below and worked successfully:

Patch(Appointments, Defaults(Appointments), { 'Interview Type': 'Interview Type (Appointments)'.Individual, Subject:"Test Interview", 'Start Time':Now(), 'End Time':DateAdd(Now(), 0.5, Hours), IsDraft: false})

 

But when I tried to create an Appointment record with the other "Interview Type Global" field set as "Individual", technically the Fx should be:

Patch(Appointments, Defaults(Appointments), { 'Interview Type Global': 'Interview Type Global (Appointments)'.Individual, Subject:"Test Interview", 'Start Time':Now(), 'End Time':DateAdd(Now(), 0.5, Hours), IsDraft: false})

It shows a red wavy line saying: "The type of this argument '***_interviewtypeglobal' does not match the expected type 'OptionSetValue'.  Found type 'Error'."

 

I also tried to remove the "Global" on the right side since they're using the exact same OptionSetValues & Labels, which becomes:

Patch(Appointments, Defaults(Appointments), { 'Interview Type Global': 'Interview Type Global (Appointments)'.Individual, Subject:"Test Interview", 'Start Time':Now(), 'End Time':DateAdd(Now(), 0.5, Hours), IsDraft: false})

It shows another error saying: "Invalid argument type.  Expecting a OptionSetValue value, but of a different schema."

 

We need both fields for our business process.  The confusing parts are:

1. Why it works on the "Interview Type" but not the "Interview Type Global“ field.  Technically a global optionset/choice column/field is what the PowerApps is suggesting more, but I'm only able to set the Local Choice field.  Is there any way to make it work on the "Interview Type Global" as well?

2. If there is no solution to the question 1, is there a way that we can set a static OptionSetValue given we already have the value to make something like in C# of Javascript:  "OptionsetValue (740110000)" to make it work instead of having to pull from the datasource like 'Interview Type Global (Appointments)'.Individual"?  If so, how to use it?

 

Thanks a lot in advance!

 

 

Categories:
I have the same question (0)
  • Verified answer
    StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @daniuosagi 

     

    Use Global Choice Field

     

    Patch(
     Appointments,
     Defaults(Appointments),
     {
     Subject: "Test Stalin Interview",
     'Start Time': Now(),
     'End Time': DateAdd(
     Now(),
     0.5,
     Hours
     ),
     IsDraft: false,
     'Interview Type Global': 'Interview Type'.Group
     }
    )

     

    In this example

     

    'Interview Type Global' - Column name in Appointment table

    'Interview Type' - Global Choice field

     

    StalinPonnusamy_0-1632281587190.png

     

  • daniuosagi Profile Picture
    55 on at

    It works!  Thanks a lot!

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 > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard