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 / Get Department from sp...
Power Automate
Answered

Get Department from specified Users

(0) ShareShare
ReportReport
Posted on by 25
Hello, 
 
 
 
I am currently trying to build a flow which will receive all departments from specific users in my organization. 
 
 
 
I have a SP-List with ~600 users filled with UPN. 



In my PowerAutomate I load the UPN into an array and try to get the department back but I can not save my Flow with following expression:



Flow save failed with code 'InvalidTemplate' and message 'The template validation failed: 'The inputs of template action 'Get_user_profile_(V2)' at line '1 and column '2612' is invalid. Action 'For_each' must be a parent 'foreach' scope of action 'Get_user_profile_(V2)' to be referenced by 'repeatItems' or 'items' functions.'.'.

 
 
My Flow looks currently like this: (Picture: Flow.png)
 
 


My Users Array Input looks like:



[
 
  "John.Doe@company.com",
 
  "Mark.Smith@company.com",
 
  "barb.Wu@company.com"
 
]
 
 
 
GetUserProfile: (Picture: GetUser.png)

 
 
 
 
 
My target is to have a different SP-List with only the departments of the specified users.
 




if you need more information I am happy to share!
 
 
 
 
 
Thanks for the help in advance! 
 
 
 
Marco


EDIT
-------
Seems like the pictures are not showing up in my post. I attached them now
GetUsers.png
Flow.png
Categories:
I have the same question (0)
  • Verified answer
    Marco3353 Profile Picture
    25 on at
    removing the "current item" from the Apply to each and change it to expression item() solved my problem!

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 468

#2
Haque Profile Picture

Haque 370

#3
Valantis Profile Picture

Valantis 354

Last 30 days Overall leaderboard