cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Saving checkbox value to a SharePoint choice column

I'm building a form which allows the user to select different types of equipment they will need for an event. The selections are in a choice column in a SharePoint list, but the users have requested to have the choices displayed as checkboxes in the app.

 

The choice column is titled 'Special Equipment'. I tried to use the Patch column like this in the OnCheck property of one of the checkboxes:

Patch(
    'SPList',
    Defaults('SPList'),
    {
        Special Equipment:{
            '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
            Value: Checkbox1.Text
        }
    }
)

 

 But it does not work, and I'm not even sure if Patch is the right route to go.

 

Thanks in advance!

5 REPLIES 5
Super User III
Super User III

@mefitzge 

PATCH is fine but you missed the ID.  You'll need to include a reference to the position of the Choice (starting at 0, 1, 2....)

Patch(
    'SPList',
    Defaults('SPList'),
    {
        Special Equipment:{
            '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
            ID: Checkbox1.ID,
            Value: Checkbox1.Text
        }
    }
)

 

The hardcoded ID might look like this...

Patch(
    'SPList',
    Defaults('SPList'),
    {
        Special Equipment:{
            '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
            ID: 1,
            Value: Checkbox1.Text
        }
    }
)

 

See this previous post for more details.

https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/How-to-Save-Choice-field-value-usin...

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Thanks, needing the ID totally makes sense. However, now I am experiencing this error:

powerappserror.png

@mefitzge 

Any possible missing brackets?  Seeing the whole code in the screenshot would be great!

@mdevaney 

 

Here's the full code:

 

Patch(
    'Conference Services Request',
    Defaults('Conference Services Request'),
    {
        'Special Equipment':
        {
            '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
            ID: 0,
            Value: Checkbox1.Text
        }
    }
)

@mefitzge 

At this point it would probably be best if you give me more information I can try to exactly replicate your problem in a test app.  Screenshots would help here too.

 

Some other ideas are:

  • How many possible Choices are in the SharePoint column?  How many can be selected at a single time?  If it is a simple yes no perhaps we can simplify by converting to boolean.
  • I assume you are PATCHing because the CheckBox is not within an Edit Form correct?  If your checkbox is within an Edit Form you might want to check out this step by step tutorial.  https://powerapps.microsoft.com/en-us/blog/multi-select-pattern-on-sharepoint-lists/

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (5,728)