Guest User

Untitled

a guest
Jul 9th, 2025
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.83 KB | None | 0 0
  1. Recurrence
  2. {
  3.   "type": "Recurrence",
  4.   "recurrence": {
  5.     "interval": 1,
  6.     "frequency": "Day",
  7.     "timeZone": "Eastern Standard Time",
  8.     "startTime": "2025-07-01T09:00:00Z"
  9.   }
  10. }
  11.  
  12. List rows present in a table
  13. {
  14.   "type": "OpenApiConnection",
  15.   "inputs": {
  16.     "parameters": {
  17.       "source": "groups/89081b99-8ab2-4f59-aee8-093778d0d441",
  18.       "drive": "b!3kzAcraAakyqX511RmVoJ9WIO311YNtKkeFu7zAlxzEzcxCs2tjvQI_OLuhM1Qgf",
  19.       "file": "01N24XK64KAGKQY5MQMFDI4XCKKQQOWKIA",
  20.       "table": "{00000000-000C-0000-FFFF-FFFF00000000}",
  21.       "dateTimeFormat": "ISO 8601"
  22.     },
  23.     "host": {
  24.       "apiId": "/providers/Microsoft.PowerApps/apis/shared_excelonlinebusiness",
  25.       "connection": "shared_excelonlinebusiness",
  26.       "operationId": "GetItems"
  27.     }
  28.   },
  29.   "runAfter": {},
  30.   "metadata": {
  31.     "01N24XK64KAGKQY5MQMFDI4XCKKQQOWKIA": "/Monthly pharmacy audit.xlsx",
  32.     "tableId": "{00000000-000C-0000-FFFF-FFFF00000000}"
  33.   }
  34. }
  35.  
  36. Completed emails
  37. {
  38.   "type": "InitializeVariable",
  39.   "inputs": {
  40.     "variables": [
  41.       {
  42.         "name": "CompletedEmails",
  43.         "type": "array"
  44.       }
  45.     ]
  46.   },
  47.   "runAfter": {
  48.     "List_rows_present_in_a_table": [
  49.       "Succeeded"
  50.     ]
  51.   }
  52. }
  53.  
  54. Map completion data
  55. {
  56.   "type": "Select",
  57.   "inputs": {
  58.     "from": "@outputs('List_rows_present_in_a_table')?['body/value']",
  59.     "select": {
  60.       "CompletionTime": "@item()?['Completion time']",
  61.       "Email": "@item()?['Email']"
  62.     }
  63.   },
  64.   "runAfter": {
  65.     "CompletedEmails_compose": [
  66.       "Succeeded"
  67.     ]
  68.   }
  69. }
  70.  
  71. Filter this month:
  72. {
  73.   "type": "Query",
  74.   "inputs": {
  75.     "from": "@body('Map_Completion_Data')",
  76.     "where": "@and(\n  not(empty(item()?['Completion time'])),\n  equals(\n    formatDateTime(item()?['Completion time'], 'yyyy-MM'),\n    formatDateTime(utcNow(), 'yyyy-MM')\n  )\n)\n"
  77.   },
  78.   "runAfter": {
  79.     "Map_Completion_Data": [
  80.       "Succeeded"
  81.     ]
  82.   }
  83. }
  84.  
  85. Apply to each
  86. {
  87.   "type": "Foreach",
  88.   "foreach": "@body('FilterThisMonth')",
  89.   "actions": {
  90.     "Append_to_array_variable": {
  91.       "type": "AppendToArrayVariable",
  92.       "inputs": {
  93.         "name": "CompletedEmails",
  94.         "value": "@{if(empty(item()?['Email']), '', item()?['Email'])}\n"
  95.       }
  96.     }
  97.   },
  98.   "runAfter": {
  99.     "FilterThisMonth_compose": [
  100.       "Succeeded"
  101.     ]
  102.   }
  103. }
  104.  
  105. Append to array variable
  106. {
  107.   "type": "AppendToArrayVariable",
  108.   "inputs": {
  109.     "name": "CompletedEmails",
  110.     "value": "@{if(empty(item()?['Email']), '', item()?['Email'])}\n"
  111.   }
  112. }
  113.  
  114. All target emails (note: all "xyz" emails are different)
  115. {
  116.   "type": "Compose",
  117.   "inputs": [
  118.   ],
  119.   "runAfter": {
  120.     "compose1": [
  121.       "Succeeded"
  122.     ]
  123.   }
  124. }
  125.  
  126. Remaining user email
  127. {
  128.   "type": "Query",
  129.   "inputs": {
  130.     "from": "@outputs('All_Target_Emails')",
  131.     "where": "@not(contains(variables('CompletedEmails'), item()))\r\n"
  132.   },
  133.   "runAfter": {
  134.     "All_Target_Emails": [
  135.       "Succeeded"
  136.     ]
  137.   }
  138. }
  139.  
  140. Apply to each
  141. {
  142.   "type": "Foreach",
  143.   "foreach": "@body('RemainingUserEmail')",
  144.   "actions": {
  145.     "Compose_1": {
  146.       "type": "Compose",
  147.       "inputs": "@items('Apply_to_each')"
  148.     }
  149.   },
  150.   "runAfter": {
  151.     "RemainingUserEmail": [
  152.       "Succeeded"
  153.     ]
  154.   }
  155. }
  156.  
  157. Compose (note: this would be replaced by "send email v2" - only using this now to figure out why its sending to everyone
  158. {
  159.   "type": "Compose",
  160.   "inputs": "@items('Apply_to_each')"
  161. }
Advertisement
Add Comment
Please, Sign In to add comment