Checking for empty column in array of documents in Power Automate/SharePoint

Ryan P 6 Reputation points
2021-12-15T16:09:19.73+00:00

I have a flow that sends any document in a specific folder through an approval process.
The approvers for my approval process are determined by a column called 'Approvers' containing people. Each document should have 'Approvers' configured.
157953-1.png

I am checking each document to make sure that 'Approvers' column is not empty.

I use a condition to do this:
empty(triggerBody()?['Approvers'])

157930-image.png

If I test this condition outside of the loop on individual files, it works fine. However in the 'Apply to each' loop like below, it always evaluates 'true'.

157991-image.png

I guess it has something to do with my use of 'value' in 'Apply to Each 5' but Im not sure how else to do it.

Not sure if there is a way to make mine work. Or maybe I should take a different approach....
Im still new at this.

SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,675 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Ryan P 6 Reputation points
    2021-12-16T14:36:38.16+00:00

    Hi ElsieLu-MSFT. Thanks for letting me know.
    Ryan

    1 person found this answer helpful.
    0 comments No comments

  2. Ryan P 6 Reputation points
    2021-12-15T22:08:22.833+00:00

    I still dont know why it doesnt work but I have found another way to do it.

    Instead of checking that 'Approvers' isnt empty, I copy 'Approvers' to an array. Then in my condition, I make sure the array isnt empty.
    158006-image.png

    I also used 'length' instead of the 'empty' function.

    Both of these differences were necessary. I dont why. If anyone knows, would be interested.

    0 comments No comments

  3. Elsie Lu_MSFT 9,761 Reputation points
    2021-12-16T06:32:04.76+00:00

    Hi @Ryan P , welcome to Q&A forum!

    In fact we are currently providing help on SharePoint in the Q&A forum, and Power Automate is a product independent of SharePoint which we are not so familiar with. Regarding the difference between these two methods which is more related to Flow, we would recommend that you go to the forum dedicated to flow for more professional help:

    Microsoft Power Automate Community

    Thanks for your support and understanding.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments