cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
shoebwk
Helper III
Helper III

unable to patch choice column in SP list

 Hi,

Trying to patch the existing SP list record choice column with the attached command but unable to get the result

 

After execution the gethelp on error shows "The specific record was not found" though SP list has the record with status"Reported".

 

Appreciate a quick help

1 ACCEPTED SOLUTION

Accepted Solutions
v-yutliu-msft
Community Support
Community Support

Hi @shoebwk ,

Could you tell me:

1)status field data type?

2)what does "ThisRecord" represent? a variable ? or something else?

If you want to update all the items that ApprovalStatus = "Reported" to ApprovalStatus:"Approved", you should use formula like this:

ForAll(
       RenameColumns(
                     Filter(
                            GalleryReported.AllItems,
                            ApprovalStatus = "Reported"
                            ),
                    "ID","ID1"),
       Patch(
Mobility,
ID=ID1,
{ApprovalStatus:"Approved"}
)
)

If Status is single choice column, try this formula:

ForAll(
       RenameColumns(
                     Filter(
                            GalleryReported.AllItems,
                            Status.Value = "Reported"
                            ),
                    "ID","ID1"),
       Patch(
Mobility,
ID=ID1,
{Status: {Value: "Approved"}}
)
)

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Pstork1
Dual Super User III
Dual Super User III

Try the following code instead

ForAll(
    Filter(
        GalleryReported.AllItems,
        Status.Value = "Reported"
    ),
    Patch(
        Mobility,
        ThisRecord,
        {Status: {Value: "Approved"}}
    )
)

Since Status is a Choice column you have to patch it with an object record.  {Value:"Approved"} will set the value property of the Status record.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Getting the same error {attached}

I can also see the Internal Field name for Status column is
/_layouts/15/FldEdit.aspx?List=%7B6BF7CC6C-A494-4A9C-A242-983541A87B83%7D&Field=pcof

Pstork1
Dual Super User III
Dual Super User III

Change it to use the internal field name.  I tested it on a choice column in one of my lists where the internal name is 'status' and it works for me.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

I am not sure why it is not work.

Here I removed the complex column dependencies and now both the columns in powerapps in SP list are text field. Still I am getting the same error

 

ForAll(
Filter(
GalleryReported.AllItems,
ApprovalStatus = "Reported"
),
Patch(
Mobility,
ThisRecord,
{ApprovalStatus:"Approved"}
)
)

v-yutliu-msft
Community Support
Community Support

Hi @shoebwk ,

Could you tell me:

1)status field data type?

2)what does "ThisRecord" represent? a variable ? or something else?

If you want to update all the items that ApprovalStatus = "Reported" to ApprovalStatus:"Approved", you should use formula like this:

ForAll(
       RenameColumns(
                     Filter(
                            GalleryReported.AllItems,
                            ApprovalStatus = "Reported"
                            ),
                    "ID","ID1"),
       Patch(
Mobility,
ID=ID1,
{ApprovalStatus:"Approved"}
)
)

If Status is single choice column, try this formula:

ForAll(
       RenameColumns(
                     Filter(
                            GalleryReported.AllItems,
                            Status.Value = "Reported"
                            ),
                    "ID","ID1"),
       Patch(
Mobility,
ID=ID1,
{Status: {Value: "Approved"}}
)
)

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,815)