web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Flow Problem - Result ...
Power Automate
Unanswered

Flow Problem - Result Type is Null

(0) ShareShare
ReportReport
Posted on by 14

Hello all,

I've been working on a small flow to change permissions on a list in SharePoint for a while.

I used this page as a guide:

https://www.netwoven.com/2020/11/03/set-item-level-permission-in-sharepoint-list-using-power-automate/

The whole thing worked before.
Now I wanted to start the whole thing again from scratch and I get the following error message with the same flow:

The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@body('Parse_JSON')?['d']?['Manager']?['results']' is of type 'Null'. The result must be a valid array.

 

I have now tried everything from completely recreating, testing each step individually, but I keep getting this error.

Can anyone tell me why this error is occurring and how I can fix it?
As I said, I followed the instructions exactly.

Best regards and thank you very much!

Categories:
I have the same question (0)
  • RonGwi Profile Picture
    14 on at

    I have now screenshots of the entire flow, the used IDs and the SPO list.

    Error while testing the flow: 

    https://ibb.co/VJHP9gn

    List in SPO: 

    https://ibb.co/zx27f1Y

    Settings of the flow:
    https://ibb.co/XZS3JKt

    https://ibb.co/1L9wjHL

    https://ibb.co/1ngMWNJ

  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @RonGwi,


    A couple of things about those instructions.

     

    1. First of all the Send an HTTP request to SharePoint - Get User List request would not return a results property in the outputs without Headers. That would explain why you are getting a null value for this field.

     

    2. The manager column would only return one manager, not multiple managers, correct? So, I would say there really is no need to loop through a bunch of items. (Unless that Manager field allows selection of multiple manager for one item 😁)

     

    I would suggest to use an expression Instead of the Parse Json and the apply to each action. 

     

    outputs('Send_an_HTTP_request_to_SharePoint_-_Get_User_List')?['body']['d']['Manager']['Id']

     

    In your setup that could look like the below:

    _api/lists/getByTitle('ContactList')/items(@{triggerOutputs()?['body/ID']})/roleassignments/addroleassignment(principalid=@{outputs('Send_an_HTTP_request_to_SharePoint_-_Get_User_List')?['body']['d']['Manager']['Id']},roledefid=1073741827)

     

    principalid_manager.png

     

     

     

  • RonGwi Profile Picture
    14 on at

    Hello Expiscornovus,

    thank you very much for your answer. I rebuilt the whole thing and now I get another error:

     

    error_new.JPG

     

    I've already seen in another post where you talk about a "URL parameter".
    How can I include that in an example?

     

    Best regards

    EDIT: And yes, in my example I only need one manager and not several. The instructions were only designed so that there can be more than one manager, but I don't need that. 🙂

  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @RonGwi,

     

    This Url should be pretty short. The id of the item and the principalid wouldn't be more than 2 or 3 characters honestly.

     

    So, I am surprised you are hitting that maxUrlLength limit.

     

    Before we try to workaround the maxUrlLength limit can you show me what the actually Uri field is in the inputs section of the Send an HTTP request action of the failed flow run history?

     

    Just to double check. You have added the expression via the expression editor? Not as plain text, correct?

  • RonGwi Profile Picture
    14 on at

    Hi,
    Let me show you how it's set up and what the erroneous output looks like:forum_setting1.JPG

    error_new2.JPG

  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @RonGwi,

     

    I see you are retrieving the whole body in the items() part of your Uri. So, that would explain why the url is too long 🙂

     

    Please add the ['d']['Id'] reference to that expression retrieving the id of the Get User List item.

     

    onlybeanumber.png

     

  • RonGwi Profile Picture
    14 on at

    Hello again,

    I am now getting a new error. Sorry, as the question, I am still quite new in the field and do not understand the syntax of the whole yet completely. 🙂

    Here again 2 screenshots of the configuration and the error.
    forum_setting3.JPG

    error_new3.JPG

     

     

    I just do not know why the error is displayed in German.
    There it says: The operation is not allowed for an object that inherits permissions.

  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @RonGwi,

     

    Did the rebuild of your flow include step 2 of the original instructions. The item first needs to have unique permissions before you can add somebody to it. That was step 2 in the original blog you referred to.

     

    Apologies if it was not clear. My suggestion was to keep following that blog but to only remove step 4. And change step 5 (to not use an apply to each but use an expression instead to get the principalid value).

     

    If it helps I can create a screenshot of the whole suggested flow setup?

  • RonGwi Profile Picture
    14 on at

    Oh yes I would like to see the screenshot. Thank you!

  • Verified answer
    Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @RonGwi,

     

    This could be the whole setup.

     

    Here are the three Uri values. Just copy/paste them into your flow.

     

    Set unique permissions

    _api/web/lists/getbytitle('ContactList')/items(@{triggerOutputs()?['body/ID']})/breakroleinheritance(copyRoleAssignments=false,clearSubscopes=true)

     

    Retrieve Manager Principal Id

    _api/web/lists/getbytitle('ContactList')/items(@{triggerOutputs()?['body/ID']})?$select=Manager/Id&$expand=Manager

     

    Add roleassignment

    _api/lists/getByTitle('ContactList')/items(@{triggerOutputs()?['body/ID']})/roleassignments/addroleassignment(principalid=@{outputs('Send_an_HTTP_request_to_SharePoint_-_Get_User_List')?['body']['d']['Manager']['Id']},roledefid=1073741827)

     

    wholeflowsetup_breakpermissinos.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard