cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rich106
Regular Visitor

Check if filtered SharePoint list is empty

I am attempting to create a flow which after updating the end date of a member record, then rechecks the SharePoint list the record is stored in for duplicates of that members email (this would occur if a member were to simultaneously hold two positions in my organization.) 

I am unsure how to code the condition that would work for this. I have filtered the SharePoint Get Items action to return only results with a default end date (still active) and an email equal to the member in question. If the array is empty (no additional positions) then an email commanding our Listserv system to remove them is sent. If the array contains a value (they hold an additional position) then no action is taken.

 

Question: How to set condition whether SharePoint Get Items array is empty? 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @rich106,

 

Could you please show a bit more about the End Date column that you mentioned? Is it a Date type column in your SharePoint list?

Further, do you want to check if the result the "Get items" action returned is empty?

 

I have made a test on my side and please take  atry with the following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a "Get items" action, specify Site Address and List Name. Wihtin Filter Query field, type the following formula:

 

Due_x0020_Date eq '2018-03-01'

Note: The Due Date column is a Date type column in my SharePoint list.

 

 

  • Add a Condition, click "Edit in advanced mode", type the following formula:

 

@empty(body('Get_items')?['value'])

Note: On your side, you should type the follwoing formula within Condition box:

 

@empty(body('Get_ISG_Members_List_-_Post_Removal')?['value'])

The 'Get_ISG_Members_List_-_Post_Removal' is the action name of your "Get items" action.

 

 

  • Within "If/yes" branch of Condition, add a "Send me an email notificaiton" action.
  • Within "If/no" branch of Condition, do nothing.

Image reference:17.JPG

The flow works successfully as below:18.JPG

 

 

More details about using expression (WDL expression) in flow actions, please check the following article:

Using expression in flow actions

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-xida-msft
Community Support
Community Support

Hi @rich106,

 

Could you please show a bit more about the End Date column that you mentioned? Is it a Date type column in your SharePoint list?

Further, do you want to check if the result the "Get items" action returned is empty?

 

I have made a test on my side and please take  atry with the following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a "Get items" action, specify Site Address and List Name. Wihtin Filter Query field, type the following formula:

 

Due_x0020_Date eq '2018-03-01'

Note: The Due Date column is a Date type column in my SharePoint list.

 

 

  • Add a Condition, click "Edit in advanced mode", type the following formula:

 

@empty(body('Get_items')?['value'])

Note: On your side, you should type the follwoing formula within Condition box:

 

@empty(body('Get_ISG_Members_List_-_Post_Removal')?['value'])

The 'Get_ISG_Members_List_-_Post_Removal' is the action name of your "Get items" action.

 

 

  • Within "If/yes" branch of Condition, add a "Send me an email notificaiton" action.
  • Within "If/no" branch of Condition, do nothing.

Image reference:17.JPG

The flow works successfully as below:18.JPG

 

 

More details about using expression (WDL expression) in flow actions, please check the following article:

Using expression in flow actions

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

WORKAROUND: Note that you can no longer use Condition: edit in advanced mode.

 

So what I did was (after adding Get Items):

  1. Add a Compose action, entered the code: empty(body('Get_items')?['value'])
  2. Add a Condition,
    1. entered the Compose Output from the Dynamic Content menu in the first field,
    2. chose Is equal to for the second field,
    3. then added the True expression for the third field.

@YouveGotSME 

Thanks for this mate! Why we would even think to add a 'Compase' action before a condition I have no idea ... but it works!!! I've just spent a day and a half trying to get my flow to work and this little tip fixed it in 5mins.

 

Cheers

Helpful resources

Announcements
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (69,025)