Showing results for 
Search instead for 
Did you mean: 
Helper II
Helper II

Help with Patch a new record to Booking Alert Entity

I'm trying to patch a new record to the OOB booking alert entity.  There's an custom optionset that specify which type of booking alert (ie. notes, photo etc). 

When I use this formula: Patch('Booking Alerts', Defaults('Booking Alerts'), {'Booking Alert Type': 'Booking Alert Type'.Note, Subject: Note_Subject_TextInput.Text})

it gave me this error. 


I'm not sure how to resolve. Please help. 

Super User
Super User

Hi @yichingjc,

What type of control 'Booking Alert Type'? To update optionsets, you'll need to set the integer value of the optionset item. Here's an updated sample of your code. I'm assuming you're using a non-global optionset and getting the optionset value from a dropdown:

Patch('Booking Alerts', Defaults('Booking Alerts'), {'Booking Alert Type': LookUp(Choices('Booking Alerts'.'Booking Alert Type'), Value = Dropdown1.Selected.Value).Value, Subject: Note_Subject_TextInput.Text})


Hope this helps

Thanks but I don't think thats correct. You are supposed to patch CDS optionset like this (see screenshot).  I think my issue isn't the optionset, its the Owner Field and I know it is a User. I'm not sure how to patch that...When I tried Owner: First(User()) it still gives me the same error. 



Could be, there are different ways to patch option sets and also depends on the connector used. It's very possible the issue can be with the Owner field. Can you please share your updated patch again as I don't see the Owner getting patched in your original one. Cheers!

I tired patching this - 




But that still gave me the same error at the beginning. The given key was not present in the dictionary. I wish it can tell me more.....


I also tried - setting a variable for the owner field as I know its USER (polymorphic lookup)
I set the variable to be onVisible of the screen = Set(varUser, First(Users).User)



Patch('Booking Alerts', Defaults('Booking Alerts'), {'Booking Alert Type': 'Booking Alert Type'.Note, Subject: Note_Subject_TextInput.Text, Owner: varUser})
It still gave me error below -

"The type of this argument '_ownerid_value' does not match the expected type 'Polymorphic'. Found type 'Guid'."


Tagging - @Shanescows  Hoping you can shed some light in this. 

Helpful resources

Ignite 2022


Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (1,648)