cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate V
Advocate V

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
Highlighted
Dual Super User III
Dual Super User III

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 III
Dual Super User III

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.
Highlighted
Advocate V
Advocate V

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

 

 

Highlighted
Dual Super User III
Dual Super User III

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

Highlighted
Advocate V
Advocate V

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.

Highlighted
Dual Super User III
Dual Super User III

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors
Users online (7,645)