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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Foreach item value not...
Power Automate
Suggested Answer

Foreach item value not retrieved

(0) ShareShare
ReportReport
Posted on by
Hi,
 I'm using a flow to count the emails inside a columns in a sharepoint list (ex: pippo@example.it; pluto@example.com will return "2")
I'm using a Get_Items action to read the list, the a Foreach action to work on single item
 
I combine the split function with length to count the occurrences of "@": length(split(items('Foreach')?['siteOwners'], '@'))
The test raises error for missing value (null):
 
So I simplified the function to extract only the siteOwners data in a variable: items('Foreach')?['siteOwners']. The test run without error but output is null
 
Note thatI checked Foreach output that reports 4 items to loop,  each one with SiteOwners columns with data.
 
 
So I think the  error raised by split function is for null value, but not for missing value but concerned a syntax error in "items('Foreach')?['siteOwners']." Where is the error in the flow?
 
Tks
Categories:
I have the same question (0)
  • Suggested answer
    rzaneti Profile Picture
    4,476 Super User 2026 Season 1 on at
    Hi,
     
    Based on the shared images, it looks like Power Automate cannot find the property siteOwner in your SP List records. Since you are using the question mark before the property reference, Power Automate returns a null whenever the property is missing.
     
    I recommend you to double check if siteOwner is the actual logical name of the SharePoint column. You can do it by checking the raw outputs from your Get items action (if you don't know how to access the raw outputs, follow these steps), and try to identify the name of the property that contains your data. Eventually the property name starts with a capital letter, and it can be breaking your flow. 
     
    Also, once the flow works, I recommend you to review the outputs from your expression, since it looks like it will return always 1 more result than the total quantity of email addresses. If you apply a split to the text "pippo@example.it,pluto@example.com" using the "@" as separator, you will have a total of 3 items in your array: "pippo", "example.it,pluto" and "example.com". If this is the case, I would recommend you to use a comma as separator :)
     
    Let me know if it works for you or if you need any additional help!
    -------------------------------------------------------------------------
    If this is the answer for your question, please mark the post as Solved.
    If this answer helps you in any way, please give it a like.
  • Suggested answer
    SudeepGhatakNZ Profile Picture
    14,396 Most Valuable Professional on at
    Try the following expression in your Foreach. This should handle null values
     
    if(empty(items('Foreach')?['siteOwners']), 0, length(split(items('Foreach')?['siteOwners'], '@')) - 1)
     
     
  • AC-22101443-0 Profile Picture
    2 on at
     I made some changes during the day and moving the main function in a Compose action
    length(split(items('Foreach')?['siteOwners'], '@'))
    then the run works
     
    Also I added a condition to work almost one occurrence is found
     
    Thk @all for suggestion 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 801

#2
Valantis Profile Picture

Valantis 602

#3
Haque Profile Picture

Haque 581

Last 30 days Overall leaderboard