cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
MrNigel
Level 8

Cannot Set Variables from SharePoint List query output

The flow references a SharePoint List, each row contains three email ids for the roles AP, SSC and DPO for the specified location.  All I want to do is set each variable to the relevant SharePoint column email id:

LocationPeople.PNG

The flow runs with no errors, but each of the variables are null.  The filter query statement has the Location variable single quoted and the People view is just the three role email ids.

 

What is the simple mistake I am making? 

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Cannot Set Variables from SharePoint List query output

The point was that the run would show whether the get items returned values or not.  And if it returned values would let you see what the JSON of the returned values was.  AS I said, using oyur current code I don't think you will get anything except the values for the last item that was retrieved.  But assuming nothing else is going wrong you should get at least the last set of values in the variables you declared.  Since you aren't, either you aren't getting any rows or the last row has blank values for those fields or the fields are a different type and you are losing the values while casting. Tracking the actual data being returned is the best way to figure that out.



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

View solution in original post

5 REPLIES 5
Dual Super User
Dual Super User

Re: Cannot Set Variables from SharePoint List query output

Can you provide a screenshot from one of the recent runs.  I'm wondering if your Get Items Odata filter is working and you are actually getting a single record back.  If you are getting more than one it doesn't make any sense to use a single variable for each.  In that case you would need each of the three variables to be an array and use the Append to Array variable action.  Are you actually getting records to process?  If more than one does the last record in the collection have empty fields.



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

Re: Cannot Set Variables from SharePoint List query output

@Pstork1 - the Test mode screenshot doesn't help because there are no errors and the Get Items action in in an 'Apply to each' loop.  Each Location row has three columns that contain three email ids, I don't see any reason why the Odata query would fail as it is simple.  I have double checked the three columns contain data (they do) and I deliberately left a single quote off so it failed and I could peek the code - the Location is definitely set to the correct text string that will only return a single row.

LocationPeople2.PNG

 

 

Dual Super User
Dual Super User

Re: Cannot Set Variables from SharePoint List query output

The point was that the run would show whether the get items returned values or not.  And if it returned values would let you see what the JSON of the returned values was.  AS I said, using oyur current code I don't think you will get anything except the values for the last item that was retrieved.  But assuming nothing else is going wrong you should get at least the last set of values in the variables you declared.  Since you aren't, either you aren't getting any rows or the last row has blank values for those fields or the fields are a different type and you are losing the values while casting. Tracking the actual data being returned is the best way to figure that out.



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

View solution in original post

MrNigel
Level 8

Re: Cannot Set Variables from SharePoint List query output

@Pstork1 - apologies for my previous terse response, I really shouldn't do a quick reply on a mobile phone!  Of course you were correct in your assumption that the filter query was failing, a quick look at the run showed these leading spaces in the query string:LeadingBlanks.PNG

 

This was entirely down to my laziness in creating the Location variable by just 'adding' five variables instead of using (concat) to merge them.  This got rid of the leading spaces and now my query works perfectly.  What makes this slightly embarrassing is that I have been doing SQL stuff since I started with Informix in 1985.......  Never stop learning!  Thank you.

Dual Super User
Dual Super User

Re: Cannot Set Variables from SharePoint List query output

Glad you found the solution.  Let us know if you run into any other issues.  Often you just need a different set of eyes on the problem.  It happens to me all the time.



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

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 309 members 3,295 guests
Please welcome our newest community members: