By leveraging Microsoft Forms and Power Automate, this project aims to streamline the process of assessing HSSE risks for contractor activities. The flow will collect responses from a form, categorize the risk level, generate a PDF report, and archive and email the results. The flow includes branching based on different modes and risk levels, ensuring a comprehensive and adaptive approach to risk management.
The original prompt:
I need help developing a Power Automate Flow. I have very little experience with Power Automate. Please tell me step by step how to build a Power Automate flow based on the following. Please explain it on a level of someone with no experience with Power Automate and for every step you tell me to do, tell me the reason why you are telling me to do it and give definitions of power automate terms and functions you have me to do as well. Here are the details of the flow I need: I have already built a Microsoft Form called SPM Contractor HSSE Risk Assessment. It has 10 questions. Here they are listed below, and in parentheses next to each one I will tell you the type of Microsoft Forms question it is and what the options are under each and the branching details if applicable. Everything in parenthesis are instructions and information for you. The form has branching that is based on 3 modes: Mode 1, Mode 2, and Mode 3, and one last option of, “Multi-Mode. All the selections and input typed by the responders will have to be printed out on a PDF along with other pieces of information. The PDFs will be emailed and archived in a folder.
. Each has a different path and questions. Here are the questions of the Microsoft form entitled SPM Contractor HSSE Risk Assessment:
1. Type the name of this scope (This is a text question).
2. Please provide a short description of the scope of work to be performed by the contractor (This is a text question).
3. What is the Contract Mode of the scope of work to be performed? (This is a choice box and has branching. The choices are below for this question)
Mode 1
a. - (This one has branching that goes to the following choice check box options The question for this branch option is 4 below, but it is for “Mode 1 above”. The answers below will be used in the flow to determine the HSSE Risk Level.):
4. Please check which activities may be part of the scope of work to be performed by the contractor? Check if answer is 'Yes'. leave blank if 'No'. Here are the options for this one: Will work activity require a Hot Work Permit? (Below are the questions the user has to check the boxes for if the answer is yes, and they leave the box blank if the answer is “No”. (I will need the responses to these questions in the flow later. They will determine the level of HSSE Risk Level. If the box is checked for each of the questions below in section 4, it will correlate to an HSSE Risk Level. The HSSE Risk Levels are High, Medium, and Low. If no box is selected for the questions below in section 4, then the HSSE Risk Level is Low. If the HSSE Risk Level is low, then put on the output PDF, “HSSE Risk Level: LOW”, ARCHIVE IT, AND EMAIL RECIPIENTS. If a box is checked in the questions below for section 4, then HSSE Risk Level will be either HIGH or LOW. The way you will tell if each questions is HIGH or LOW is based upon whether HIGH or LOW is in brackets like these [HIGH] or [LOW] at the end of each question. If you find at least one question in the section 4 list below that has [HIGH] below then the HSSE Risk Level for the entire form is HIGH, and you will print on the PDF output: HSSE Risk Level: HIGH)
Will work activity require a Hot Work Permit within a Process Unit? [HIGH]
Will work activity be located above 6 feet requiring the use fall protection equipment? [HIGH]
Will work involve Confined Space Entry / Restricted access or egress / trenching? [HIGH]
Other than driving to and from a job site, are there other potential hazards associated with vehicle movement while on company property? [MED]
Will work require process isolation? [HIGH]
Will work involve heavy lifting or hoisting controlling of a Suspended Load? [HIGH]
Will gas testing be required before or during the work activity? [MED]
Will work activity require obtaining authorization before overriding or disabling safety critical equipment? [MED]
Will work activity be within a live Process Area Flare Zone? [MED]
Will work involve the use of tools or equipment that have the potential to result in serious harm or injury to self or others? [MED]
Will work activity be near other people that may result in serious harm or injury? [MED]
Will the work activity require the use of specialized tools or equipment? e.g. High-pressure water or hydraulic systems. [MED]
Will the work activity require the use of Respiratory Protective Equipment? [MED]
Will any of the following hazards be present during the work activity: Pressure (+/-), Flammable Materials, Toxics, Thermal (hot/cold), Radioactive Sources. [MED]
There are other potentially hazardous activities not listed above.
(All of the questions above are check boxes that at least one must be check. Once they are checked they go to Section 5 which is a text box. Section 5 is below).
Section 5. Are there other potentially hazardous activities not listed above? (The answer to this one will be a text answer that needs to be output on the PDF. Put on the PDF the following statement: Other potentially hazardous activities not described here. Then list what the respondent typed in the text box)
Mode 2
(This option, Mode 2, when selected branches to 4 below and then question 5. Both of these and their responses will need to be printed on the output PDF).
4. If you have already identified some prospective suppliers to perform this scope, please list them below (This is a text box question. I will need the question 4 and the text box response of this question put in the output which is a pdf. The other wording in the PDF will be, Mark, this new scope is a Mode 2. Below is the response from “PERSONS NAME”. Please determine if this is HIGH, MED, or LOW risk).
Please describe other potentially hazardous activities not listed above. If N/A, hit the submit button below. (This question and response will need to be printed on the output PDF. This is a text question in Microsoft Forms.)
Mode 3
– (This option, Mode 3, when selected branches to 4 below. 4 below has check boxes. I will need to know which ones in 4 below are checked off by the person that responded. The ones that are check off will be used to determine the HSSE Risk Level which will then be output in the pdf).
4. Does the scope of work to be performed involve any of the circumstances described below? (I will need the check box response of this question put in the output which is a pdf, and you will have to use it to determine what the output will be. Each check box question below is separated.)
Transportation of people (including Shell and/or contractor personnel) and/ or goods is the primary scope provided (e.g. . freight forwarding, bussing, air transportation, etc.).
The scope includes Shell personnel performing physical work or activities at a 3rd party location (e.g. active training, HSSE risk activities at third party facilities e.g.
Scope taking place in a Contractor operated facility e.g. warehouse, workshop, etc., that is estimated to make up more than 50% of the facility's capacity at any one time.
Scope taking place in a public location [e.g. public roadway, etc.].
None of the above are anticipated to be included in the scope of work. (If this one is selected, then it is HSSE Risk Level, LOW. LOW risk levels get archived and emailed to the recipients.)
(If one of the above for this Mode 3 is selected, the form then goes to Section 5 below which is a text box if there are prospective suppliers. If there are not it can be left blank. If text is input then it needs to be put on the output PDF.
Section 5 If you have already identified some prospective suppliers to perform this scope, please list them below.
(This Mode 3 option now goes to Section 6 below which is a text box. The answers given by the responders will need to become output in the PDF output at the end of the flow)
Section 6 Please describe other potentially hazardous activities not listed above. If N/A, hit the submit button below. (If any text is listed here, it must be placed in the PDF document.
Multi-Mode
(This is another option. If this one is chosen by the responder, the responder will have to select at least one of the questions in sections 4, 5, 6, and 7 below. The selections that the responder clicked will need to be emailed to Mark.Kennedy2@shell.com ).
Section 4
What activities may take place as part of the scope of work to be performed by the contractor on-site? Check if answer is 'Yes'. leave blank if 'No')
Will work activity require a Hot Work Permit?
Will work activity require a Hot Work Permit within a Process Unit?
Will work activity be located above 6 feet requiring the use fall protection equipment?
Will work involve Confined Space Entry / Restricted access or egress / trenching?
Other than driving to and from a job site, are there other potential hazards associated with vehicle movement while on company property?
Will work require process isolation?
Will work involve heavy lifting or hoisting controlling of a Suspended Load
Will gas testing be required before or during the work activity?
Will work activity require obtaining authorization before overriding or disabling safety critical equipment?
Will work activity be within a live Process Area Flare Zone?
Will work involve the use of tools or equipment that have the potential to result in serious harm or injury to self or others?
Will work activity be near other people that may result in serious harm or injury?
Will the work activity require the use of specialized tools or equipment? e.g. High-pressure water or hydraulic systems.
Will the work activity require the use of Respiratory Protective Equipment?
Will any of the following hazards be present during the work activity: Pressure (+/-), Flammable Materials, Toxics, Thermal (hot/cold), Radioactive Sources.
5
Do any of the offsite activities involve any of the circumstances described below?
Check any activities that form, or may form, part of the expected scope of work.
Transportation of people (including Shell and/or contractor personnel) and/ or goods is the primary scope provided (e.g. . freight forwarding, bussing, air transportation, etc.).
The scope includes Shell personnel performing physical work or activities at a 3rd party location (e.g. active training, HSSE risk activities at third party facilities (e.g.)
Scope taking place in a Contractor operated facility (e.g. warehouse, workshop, etc.), that is estimated to make up more than 50% of the facility's capacity at any one time.
Scope taking place in a public location (e.g. public roadway, etc.).
None of the above are anticipated to be included in the scope of work.
6
If you have already identified some prospective suppliers to perform this scope, please list them below.
If no, please leave blank.
7 Please describe other potentially hazardous activities not listed above. If N/A, hit the submit button below.
(All of the above responses for Multi-Mode will need to be printed on the output PDF)
Introduction to Microsoft Forms and Power Automate
Overview
This unit introduces Microsoft Forms and Power Automate and illustrates their use for automating processes. We'll demonstrate how to create an automated workflow for assessing and managing Health, Safety, Security, and Environment (HSSE) risks for contractor activities.
Microsoft Forms
Microsoft Forms is a simple web-based application that allows users to collect data via surveys, quizzes, and polls.
Power Automate
Microsoft Power Automate (formerly Microsoft Flow) is a service that enables the creation of automated workflows between different applications and services without the need for coding.
Body: "A high-risk activity has been reported. Please review the details: \n Contractor Name: [Contractor Name] \n Activity Date: [Activity Date] \n Description: [Description of HSSE risk]"
Add appropriate email recipients.
Create a Task in Planner:
Add an action "Create a task" in Planner.
Configure the task details using dynamic content from the form:
Title: "Review HSSE Risk for [Contractor Name]"
Assigned to: [Appropriate individual]
Notes: [Description of HSSE risk]
Start Date: [Activity Date]
Log response in Excel/SharePoint:
Add an action "Add a row into a table" for Excel, or "Create item" for SharePoint.
Select the appropriate storage location and map form responses accordingly.
Step 3: Test the Flow
Submit a test response using the Microsoft Form.
Verify that the actions in the Power Automate flow are triggered correctly.
Check that the email is received, the task is created, and the form data is logged as expected.
Conclusion
By integrating Microsoft Forms and Power Automate, you can efficiently streamline the process of assessing and managing HSSE risks for contractor activities. This automation reduces manual effort and ensures timely and organized risk management.
Creating and Managing Microsoft Forms for Data Collection
This section demonstrates how to use Microsoft Forms for data collection regarding HSSE risks for contractor activities. It will then describe using Power Automate to automate the assessment and handling of the collected data.
Step 1: Designing the Microsoft Form
Create a New Form
Navigate to Microsoft Forms.
Click on "New Form".
Name the form e.g., "HSSE Risk Assessment for Contractor Activities".
Click on "Create" and select "Automated cloud flow".
Setting the Trigger
Choose the trigger: "When a new response is submitted" in Microsoft Forms.
Link it to the "HSSE Risk Assessment for Contractor Activities" form.
Add Actions to the Flow
Get Response Details
Action: "Get response details"
Form ID: Select your form.
Response ID: Use the unique identifier provided in the previous trigger step.
Condition for Risk Type
Action: "Condition"
Condition: If "Identify Potential Risks" Contains "Fall" (Repeat for all risks)
Condition Outcomes
If Yes:
Add action "Send an email".
Set up the email with appropriate risk details; e.g.:
To: safety.officer@example.com
Subject: HSSE Risk Identified: Fall
Body: A potential fall risk has been identified. Details: {Details from response}.
Step 3: Example Flow Diagram
[Trigger: New Form Response Submitted]
|
v
[Action: Get Response Details]
|
v
[Condition: If "Identify Potential Risks" Contains Specific Risk]
| | | |
v v v v
[Condition: Fall]---> [Condition: Electric Shock]---> [Condition: Burn]---> [Condition: Chemical Exposure]
| | | |
v v v v
[Send Email] [Send Email] [Send Email] [Send Email]
Send an Email Action Example Configuration
To: recipient@example.com
Subject: HSSE Risk Alert: {RiskType}
Body:
Attention,
A new HSSE risk has been identified from the contractor activities.
Contractor: {Name of Contractor}
Activity: {Description}
Date: {Date}
Risk Type: {RiskType}
Please address this immediately.
Best regards,
HSSE Team
Conclusion
By designing a Microsoft Form and using Power Automate, personnel can efficiently collect, assess, and handle HSSE risks related to contractor activities. This automated flow helps ensure that risks are promptly communicated to the appropriate safety officers for immediate action.
Designing Power Automate Flows: An Overview
The purpose of this section is to implement a workflow using Power Automate to assess and manage HSSE (Health, Safety, Security, and Environment) risks for contractor activities. This workflow will collect data from Microsoft Forms, evaluate the information, and execute actions based on risk assessment criteria.
Step 1: Trigger Flow with Form Submission
Flow Trigger: Use the "When a new response is submitted" trigger for Microsoft Forms.
Trigger:
- When a new response is submitted (From your specific Microsoft Form)
Get Response Details: Use the "Get response details" action to fetch the detailed responses from the form.
Action:
- Get response details
- Form ID: [Your Form ID]
- Response ID: [Response ID from trigger]
Step 2: Initialize Variables
Initialize Variables: Create variables to store the parsed form data.
Action:
- Initialize variable
- Name: contractorName
- Type: String
- Value: [Response data corresponding to contractor name]
- Initialize variable
- Name: riskLevel
- Type: String
- Value: [Response data corresponding to risk level]
Step 3: Assess Risk Level
Condition to Evaluate Risk:
Condition:
- If riskLevel equals 'High'
Notification for High Risk:
Send Email to HSSE manager with details.
Create a Task in Planner for immediate attention.
Actions:
- If True:
- Send an email
- To: HSSE Manager
- Subject: High Risk Contractor Activity
- Body: Details of contractorName and associated risks
- Create a task (Planner)
- Plan Id: [Planner Plan ID]
- Title: High Risk Contractor Activity: [contractorName]
- Assigned To: [HSSE Manager]
- Due Date: [Appropriate date]
- If False:
- Proceed to next action
Step 4: Documentation and Logging
Log the Information:
Log all activities and decisions to a SharePoint list for record-keeping and future reference.
Action:
- Create item (SharePoint List)
- Site Address: [Your SharePoint site address]
- List Name: HSSE Risk Log
- Title: Risk Assessment for [contractorName]
- Risk Level: [riskLevel]
- Status: [Appropriate Status]
Step 5: Confirmation and Completion
Send Confirmation: Notify the person who submitted the form.
Action:
- Send an email
- To: [Submitter’s Email]
- Subject: Form Submission Receipt
- Body: Thank you, [Submitter’s Name]. Your submission regarding the activity of [contractorName] has been received and is under process.
Flow Diagram Outline
Start -> Trigger (Form Submission) -> Get Response Details -> Initialize Variables
-> Condition (Evaluate Risk Level)
-> If High Risk:
-> Send Email to HSSE Manager
-> Create Task in Planner
-> If Not High Risk:
-> Proceed to Next Step
-> Log Information to SharePoint
-> Send Confirmation Email
End
Conclusion
This practical guide demonstrates how to leverage Power Automate to build workflows that handle HSSE risks for contractor activities. It ensures data is collected, assessed, and actions are taken through automated processes, enhancing efficiency and safety management. Implementing this blueprint helps in maintaining an organized, responsive, and compliant HSSE management system.
Implementing Conditional Logic and Branching in Flows
In Power Automate, implementing conditional logic and branching allows you to create a flow that can diverge based on certain conditions. We'll assume you have a basic understanding of creating flows and directly dive into the conditional logic and branching within a flow to assess and handle HSSE (Health, Safety, Security, and Environment) risks for contractor activities.
Here's a step-by-step process on how to incorporate conditional logic and branching in your Power Automate flow:
Step 1: Trigger
Assume the trigger is already set up using a form response to capture contractor activity details.
Step 2: Initialize Variables
Initialize variables if needed to store any data for condition checks later on. You can do this by inserting the "Initialize variable" action:
Action: Initialize variable
Name: RiskLevel
Type: String
Value: Empty
Step 3: Apply Conditional Logic
Use the "Condition" control to apply conditional logic.
Example Scenario:
Let's assume the form has a field named "Risk Assessment" that categorizes the risk into "High", "Medium", and "Low". Based on this risk level, we need to perform different actions.
Action: Condition
Condition: If "Risk Assessment" is equal to "High"
Inside Condition (High Risk)
Branch 1 (If Yes):
Action: Set variable
Name: RiskLevel
Value: High
Action: Send an email
To: hsse.manager@company.com
Subject: High Risk Activity Detected
Body: A high-risk contractor activity has been reported. Immediate action required.
Branch 2 (If No): Add another condition to handle medium risks.
Step 4: Nested Condition for Medium Risk
In the "If No" branch of the first condition, add another condition to check if the risk level is medium.
Action: Condition
Condition: If "Risk Assessment" is equal to "Medium"
Inside Condition (Medium Risk)
Branch 1 (If Yes):
Action: Set variable
Name: RiskLevel
Value: Medium
Action: Send an email
To: hsse.team@company.com
Subject: Medium Risk Activity Detected
Body: A medium-risk contractor activity has been reported. Please review and take necessary precautions.
Branch 2 (If No): This branch will handle low-risk activities implicitly.
Step 5: Handling Low Risk (Implicit Else)
After the nested conditions for both "High" and "Medium" risks, you can handle the low-risk scenario as:
Action: Set variable
Name: RiskLevel
Value: Low
Action: Send an email
To: hsse.auditor@company.com
Subject: Low Risk Activity Detected
Body: A low-risk contractor activity has been reported. No immediate action required, but recordkeeping is necessary.
Step 6: Additional Branches (If Required)
Based on your requirements, you may add more branches or nested conditions by repeating Steps 3 and 4 and modifying the logic accordingly.
Conclusion
You now have a Power Automate flow that assesses HSSE risks based on contractor activity details, using conditional logic to branch and handle each risk level appropriately. This structured branching and conditional handling ensures that each risk category triggers specific necessary actions.
By following these steps, you can implement conditional logic and branching in your Power Automate flows to create a dynamic and effective automated HSSE risk management process.
Generating and Managing PDF Reports with Power Automate
Overview
In this section, we detail the implementation of generating and managing PDF reports using Power Automate as part of your project for assessing and handling HSSE risks for contractor activities. Assume all preceding steps such as data collection, flow design, and conditional logic are already implemented.
Flow Structure
Step 1: Trigger Flow
Begin by triggering the flow once your form submission (data collection) is completed.
Trigger: When a new response is submitted in Microsoft Forms.
Step 2: Initialize Variables
Initialize a variable to concatenate form responses.
Action: Initialize variable
Name: ReportContent
Type: String
Value: "" (empty string)
Step 3: Get Form Responses
Retrieve the responses from the submitted form.
Action: Get response details
Form ID: [Your Form ID]
Response ID: Responses ID from the trigger
Step 4: Append Responses to Variable
Append each form response to the ReportContent variable.
File Content: Outputs from the Convert HTML to PDF action
Alternatively, email the PDF:
Action: Send an email (Office 365 Outlook)
To: Your Email
Subject: HSSE Risk Report
Body: The attached PDF report contains the latest HSSE risk assessment.
Attachments:
Name: HSSE_Risk_Report.pdf
Content: Outputs from the Convert HTML to PDF action
Full Power Automate Flow Summary
Trigger: When a new response is submitted in Microsoft Forms
Action: Initialize variable 'ReportContent' = ""
Action: Get response details
Action: Append form responses to 'ReportContent' variable
Action: Compose HTML Content
HSSE Risk Report
@{variables('ReportContent')}
```
6. Action: Convert HTML to PDF (Plumsail Documents)
- HTML Content: Outputs from Compose action
- File Name: `HSSE_Risk_Report.pdf`
7. Action: Create file (OneDrive for Business)
- Path: `/Reports`
- File Name: `HSSE_Risk_Report_@{utcNow('yyyyMMddHHmmss')}.pdf`
- File Content: Outputs from Convert HTML to PDF action
```
OR
```
7. Action: Send an email (Office 365 Outlook)
- To: Your Email
- Subject: HSSE Risk Report
- Body: The attached PDF report contains the latest HSSE risk assessment.
- Attachments:
- Name: HSSE_Risk_Report.pdf
- Content: Outputs from Convert HTML to PDF action
```
Conclusion
Follow the above steps to generate and manage PDF reports using Power Automate effectively. This approach integrates form responses, converts them into a formatted PDF, and either saves or emails the report automatically.