cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dr_David_Banner
Helper I
Helper I

Patch a CDS option set from canva app

Hi

 

I'm trying to patch a CDS option set from my Canvas app using a button. 

 

The CDS entity is called 'alerts' the field is called 'Level" and the option set is called 'qrs_alertstate'. Alertstate has a few values; Critical, Warning and OK. 

 

for the life of me I can't get this to update. Here is my code: 

 

Patch([@Alerts], ThisItem, {Level : 'Level'.Okay})

 

can anyone help? 

 

thanks in advance

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Dr_David_Banner ,

 

Yes, that is the problem.

 

The Option Set Name is Alert State, the code should be:

Patch([@Alerts], ThisItem, {Level : [@'Alert State'].'Okay'})

Hope this helps.

Sik

View solution in original post

11 REPLIES 11
eka24
Super User III
Super User III

Try:

Patch([@Alerts], ThisItem, {Level : LookUp(Level, qrs_alertstate="Okay")})

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 

 

the message I get is "function lookup as some invalid arguements" 

 

the name isn't valid, this identifier isn't recognised" 

 

Thanks

 

 

 

 

 

eka24
Super User III
Super User III

Please give a screenshot

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

image.png

I think the problem, for whatever reason is it can't find qrs_alertstate ? 

v-siky-msft
Community Support
Community Support

Hi @Dr_David_Banner ,

 

Could you please try this? The option set also need to marked by a disambiguation operator

Patch([@Alerts], ThisItem, {Level : [@'Level'].Okay})

Hope this helps.
Sik

thanks for your suggestion, this is what I get:

 

image.png

 

 

Hi @Dr_David_Banner ,

 

OK, What is the Option Set Name (Not the Option Set Field Name)?

Could you please share the Option Set Field property shown as below?

Snipaste_2020-05-29_16-03-34.png

Sik

sure: 

 

image.png

 

thanks

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,211)