Using the Microsoft 365 modern tools means having new methodologies and new approaches to exploit the maximum of the capabilities of this tools. Too often, when users need are here, the project owner asks the developers to code a new component without asking if something else can do the job.

I have seen a lot of code solutions to create a contact form on SharePoint and now the trend is to use PowerApps to avoid SharePoint Framework Web Part. PowerApps can require "too many" skills for a simple contact form but we agree that the result can be very interesting 😉

In this post, I will show you another solution based on Microsoft Forms that allows to notify new form answers without email and to manage them as tasks to the IT or the support team behind the scene.

Create a Teams

By creating a team on Microsoft Teams, you are also creating an Office 365 Group. The Teams will act as a central of notifications for the IT or support teams and the Office 365 Group will allow to attach the other  Microsoft 365 services that we will see below.

First step, if you do not already have a private Teams dedicated to receive the notifications and the other configurations below, it is highly recommended that you create a new one from scratch:

Create new Teams for Support

During the creating procedure, give a temporary name of the team like support-intranet. This name will be used to create the SharePoint site linked to the Teams as well as the email address:

  • SharePoint site URL: https://contoso.sharepoint.com/[sites|teams]/support-intranet
  • Email address: [email protected]

Channels

The final goal will be to notify the team every time a new answer was sent. To improve the communication, it is possible to create some channel by thematic. In our example, two channels were created:

  • Dev: to notify all feedbacks about the bugs, features, etc.
  • Support: to notify all support requests like accompanying and other things

Once created, you can rename your Teams, add the members and additional owners, change the logo, etc.

You are now ready for the next steps.

Create a new Forms

By default, when a user creates a Form, this one is linked to his account but it is also possible to create a Form for an Office 365 Group.

Create a Group Form

To create a Forms linked to an Office 365 Group, find and select the target Office 365 Group from Microsoft Forms:

Select an Office 365 Group from Microsoft Forms

Then, click on New Group Form:

Create a new Microsoft Group Form

Configure the First Section

The first section will act as a router in accordance with the choice of the user:

  1. Add a form title and optionally a description
  2. Add a choice action named "Tell us more, why do you want to contact us" and add options. Note that, the latest option should allow the user to detail a custom choice that does not exist:
    • If you click on Add "Other" option, the user can type directly a custom option
    • If you choose another named "Something else...", we can redirect the user to another part of the form that allows the user to specify the subject and details (that is the scenario chosen here)
  3. Ensure that the choice action is required
  4. Multiple answers must be disabled
Example of first section of Contact Form

Create Form Sections

Once the first section is created, your can create as many sections as the number of available options by performing the following steps:

  1. Click on Add new
  2. Click on the down arrow
  3. Click on Section
Create a new Section on a Microsoft Form

Create a Bug Section

Compared to the other sections, the bug one should have a File Upload field to allow to share the screenshots to help the support to reproduce the bug and fix it.

Add File Upload field into Microsoft Form

When this kind of field is used for a personal form, the attachments are uploaded into OneDrive in a specific folder Apps > Microsoft Forms > File Upload > Question.

  • Question matches with the File Upload question
  • If you add another File Upload field, the folder will be named Question1, etc. Even if you rename the File Upload field, the target folder keeps the same name.

When you use a File Upload field with a Form Group, all files will be uploaded into the default Documents library (Shared Documents) and in the Apps > Microsoft Forms > File Upload > Question subfolder.

Information message when you create an Upload Files field

It is possible to configure the behavior of the "Upload File" field by:

  • Adding a limit of files to upload (3 files is not bad)
  • Specifying the limit of size per file
  • Specifying the expected file type (by extension). If not specified, all types of files are allowed
  • This field should not be required

[info]Important

Once this kind of field is used into a form, only the people in your organization can respond to the form

Add Branches

The branches will allow to redirect the user to another section of the form in accordance with the scenarios such as those illustrated in this example:

Set up Microsoft Forms options branches
  1. I need help to manage the content -> Section "I need help to manage the content" -> End of the form
  2. I found a bug -> Section "Did you find a bug? Tell us more about this bug" -> End of the form
  3. I need a new feature -> Section "Do you need a new feature? Give us more details about what you expect about this feature" -> End of the form
  4. Something else... -> Section "Something else..." -> End of the form

To manage the branches, you must click on the ellipsis visible at the top-right corner of each section, then click on Add branching

Enable Branching in Microsoft Forms
[info]Important

Each section must be configured to go to End of the form

Contact Form Overview

Microsoft Forms branching options overview
[info]Important

Do not create a field more than once with the same name. If you have several times the same field name, that will be harder to determine which field is which one.

Planner

To create a Planner combined to a Unified Group / our Teams (Office 365 Group), go to a channel of your Teams and click on the Planner icon:

Create Planner from Teams Channel

Buckets

Once your Planner is ready, create four or more buckets that will allow to organize the answers in accordance with the selected subject at the first section of our Contact form:

  • Support
  • Feature
  • Bug
  • Other
A Planner with Buckets overview

Create a Team Flow

In accordance with the Contact form answers, all the logic lies in Power Automate.

The flow will allow to create the notifications into the Teams channel and create the Planner tasks.

Init the Flow

Before managing the different cases, it is necessary to initialize the flow to be triggered each time a new answer is sent

  1. From Power Automate, create a new flow from blank
Create new flow Power Automate
  1. The first step of a flow is to select the trigger. Each event will launch the flow. In our case, the trigger is When a new response is submitted
Select a Flow Trigger

3. To be triggered, it is necessary for the flow to know from which Microsoft Forms it has to wait for the answer. From the choice of the dropdown, select the Contact Form; if it does not appear on the list, select Enter custom value and paste the Form Id

Select the Microsoft Forms into the Flow Trigger
[success]Tip

You can retrieve the Form Id when the form is open or from the Share button (Share URL). Into the URL, the form Id is visible after the URL parameter FormId=
  1. To collect the answer details, it is necessary to add a Get response detail action. Add the action, specify the Form Id and the Response Id that come from the Trigger
Flow - Get the response details of a form

You are now ready to implement the logic of your flow.

Conditions

The conditions are the logic of this flow. For each type of answer selected from the first section, an corresponding condition must be created.

  • When the condition returns Yes, that means, the Planner task should be created and the Teams notifications should be sent
  • When the condition returns No, that means, a cascading condition must check the next case

Condition

  1. Add a condition action
  2. Select the form question - in this case, the first question of the first section of the form Tell us more, why do you want to contact us
  3. Choose the condition is equal to
  4. Type the answer case; Ex: I need help to manage the content

Planner Task

Planner tasks preview
  1. Add a Create a task (preview) action
  2. Set the Office 365 Group Id from the dropdown list: Support Intranet
  3. Set the Plan Id (Planner): Support Intranet
  4. Set the Title of the task - each section of the form has a "subject"; use the subject of the section as task title
  5. Select the Planner Bucket in accordance with the response subject
  6. Set Start Date Time by using the date time of the form answer

Unfortunately, with the Create a task action, it is not possible to set the description of the task; the description corresponds to the detail of the form response. Hopefully, it is possible to add a description to an existing task

  1. Add Update a task action
  2. Set the Task Id - the Create a task action returns the Id of the created task
  3. Set the description - each section of the form has a multilines of text field that can be used as a description of the task

Teams Notification

  1. Add a Post a message (V3) (Preview) action
  2. Select the Team: Support Intranet
  3. Select the Channel in accordance with the response subject
  4. Set a Subject of the message - each section of the form has a "subject"; use the subject of the section as task title
  5. Set the Message. This one can be written in HTML directly or as simple Rich Text. Here, a sample of HTML used for this demo that displays the e-mail of the responder and the multilines text field as description
<p></p>
<table style="widh:100%">
<tbody>
<tr><th style="width: 200px;padding: 3px;background-color: #464775;color: #fff;">Requester:</th><td style="padding: 3px;">@{outputs('Get_response_details')?['body/responder']}</td></tr>
<tr><th style="width: 200px;padding: 3px;background-color: #464775;color: #fff;">Description:</th><td style="padding: 3px;">@{outputs('Get_response_details')?['body/r1198cb2be5f24b33810913f97cc60f25']}</td></tr>
</tbody>
</table>
Team Message Content

Attachments

Planner tasks with attachments

Within the scope of  the condition that needs to manage the responses attachments of the form, a particular attention is required.

  • It is possible to have only one attachment
  • It is possible to have more than one attachment
  • It is possible to have no attachment at all

The informations about the attachments are provided as an Array of JSON object(s). The Parse JSON action needs a schema to parse correctly the content; to retrieve the schema, run a first time the flow to enter into the bug condition with at least two attachments and keep the JSON schema.

  1. Add a Parse JSON action
  2. At the content of the action, specify the Microsoft Forms file field
  3. At the schema of the action, click on Generate from sample and use the content obtained from a first launch without the Parse JSON action or use this schema directly:
    {
        "type": "array",
        "items": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string"
                },
                "link": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "type": {},
                "size": {
                    "type": "integer"
                },
                "referenceId": {
                    "type": "string"
                },
                "driveId": {
                    "type": "string"
                },
                "status": {
                    "type": "integer"
                },
                "uploadSessionUrl": {}
            },
            "required": [
                "name",
                "link",
                "id",
                "size",
                "referenceId",
                "driveId",
                "status",
                "uploadSessionUrl"
            ]
        }
    }
    
Parse form attachments from Power Automate flow
  1. Now, you can add a Apply to each action based on the body of the Parse JSON action
  2. Into the Apply to each action, insert an Update task details action
    • Specify the Task Id created into the condition
    • Into the Reference Alias - 1, specify the name of the attachment
    • Into the Reference Resource, specify the link the the attachment
Apply to each attachment, update a Planner Task

From now on, each file of the form answer will be attached to the Planner Task, but what is happening if no file was specified into the form answer?
The flow throws an exception because it cannot parse an empty field object 😕

It is necessary to check if the answer contains something into the file field:

  1. Add a condition action
  2. Into the value, the goal is to use the file field and to check if this one is empty or not. To do that, you can use the following formula:
    not(empty(outputs('Get_response_details')?['body/....']))
    
    If the value is empty, that returns true and you do not have to parse the field, else it returns false and you can parse the content and add the attachments to the Planner Task
Check if field contains something in Power Automate
[note]Note

Alternatively, rather than check if the field contains something, you can use a Scope action to prevent the flow to break on the exception

Make a Teams Flow

[note]Note

Previously called Teams flow, a flow that has several owners is available now into the Shared with me section

A teams flow is no more no less than a flow with more than one owner. In our case, to avoid specify people as owners and updating the list each time this list changes, we will use the Office 365 Group linked to our Microsoft Teams created at the beginning of the post ([email protected])

  1. Select your flow, then from the "dashboard" of your flow, click on edit owners
Flow dashboard - Edit owners link
  1. From the People Picker, specify the Office 365 group linked to your Microsoft Teams and select it from the dropdown list
Power Automate owners People Picker
  1. Click OK to the dialog overview of the current flow accesses
When add Flow owner, dialog overview of current assigned permissions

Now your flow is owned by several people through the Office 365 group and can be retrieved from the Shared with me section

Flow Overview

Power Automate Flow overview

Embed the Contact Form into your SharePoint site

This is the easiest part 😁

  1. Get the Microsoft Forms link. You can get the link when you are on the edit view of your form, and by clicking on Share, copy the link
Copy the Microsoft Form link
  1. Create a SharePoint page on your Intranet and add the Web Part Microsoft Forms
Add Microsoft Forms Web Part to SharePoint page
  1. Choose to use an existing Form and from the properties panel, paste the link into the text area. Ensure the Collect responses is checked
Paste Microsoft Form URL into SharePoint Web Part properties
  1. Publish the page and you are done



Hoping this post will help you 😉

You may also be interested in