cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Super User III
Super User III

Re: Saving checkbox value to a SharePoint choice column

@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."

Highlighted
Frequent Visitor

Re: Saving checkbox value to a SharePoint choice column

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

powerappserror.png

Highlighted
Super User III
Super User III

Re: Saving checkbox value to a SharePoint choice column

@mefitzge 

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

Highlighted
Frequent Visitor

Re: Saving checkbox value to a SharePoint choice column

@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
        }
    }
)
Highlighted
Super User III
Super User III

Re: Saving checkbox value to a SharePoint choice column

@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
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,200)