Saturday, February 24, 2018

Microsoft Flow | How to send Single mail with Multiple SharePoint List Items.

What is achieved in this Flow?

  1. Run the Flow periodically on a schedule or on some other Trigger as per your choice. 
  2. Query a SharePoint List and GetItems (multiple rows)
  3. Create an HTML Table format with specific fields to be sent in a mail. 
  4. If the Output is Empty, Do not send mail, else send mail to specific recipients. 


  1. I am triggering this Flow on 'Recurrence Schedule' Trigger. 
  2. Getting Items from a SPO List only where the column 'Status' eq 'Request Placed' [ So I am doing OData Filter Query and getting only specific rows from a possibly large SPO List ] 
  3. Next step is the 'Data Operations Select' Action. [ This will take input Only from an Array Output ] 
    1. As the 'Get Items' Output is in Array, 'Select' action works great. The output 'Value' from 'Get Items' will be the Input of  'Select'
    2. 'Map' I am entering the headings of the Table and their values from output of previous steps which will be only those items where 'Status' field value is 'Request Placed'
  4. Next step is put the output of  'Select' Action to String, coz HTML Table action will not take an Array value as Input. so we need to use 'Data operations - compose' Action and put the output of 'Select' in Compose action
  5. Next Add 'Create HTML Table' Action -> Output will be from the 'Compose' step. (by default headers are created in HTML table action Advanced options)
  6. Next I am checking a Condition output is blank (this can be done for any step, it was just easy for me to enter the select output), I wanted to send separate emails if blank and if not blank. So instead of "@empty(body('Select'))" it could also be "@empty(body('Compose')) or "@empty(body('Get_Items'))"

After checking the Condition, I am sending different mails when the condition is True and False. If the condition is False, the output from 'Create HTML table' will be sent in body of the Mail. 

No comments:

Total Pageviews