Star Ratings on Email or PDF with Power Automate

In the Power Automate community, I recently came across a question in which the user wanted to recreate the Star rating in an email. A few days back, I had a similar request from one of my customer to recreate the Star rating from Microsoft Forms to PDF, they wanted to visualize the Forms output with star’s rather than just returning their ratings as numbers between(1-5).

In this post, we’ll show you how to create a Power Automate (Flow) solution and recreate the Star rating from Microsoft Forms to PDF or just send the star ratings over the email.


Before we begin, please make sure the following prerequisites are in place:

  • An Office 365 subscription with access to Power Automate (Flow).
  • Muhimbi PDF Converter Services Online Free, full or trial subscription (Start trial)
  • Appropriate privileges to create Flows.
  • Working knowledge of Power Automate (Flow) and Microsoft Forms.


For this demo, we will convert the sample Microsoft Form (below) to PDF:


Forms Star Demo 
Hi test when you submit this form. the owner will be able to see your name and email address. 
Required 
1. Please provide Feedback 
Submit


From a High-Level our Power Automate would look like the screenshot below:


{x} 
{x} 
{x} 
When a new response is submitted 
Get response details 
Initialize variable Counter 
Initialize variable Star 
Initialize variable Feedback Integer 
Do until 
is equal to 
Edit 
limits V 
{x} 
{x} 
Append to string variable(Star) 
Increment variable Cauter 
Compose Star rating 
Convert HTML to PDF 
Send an email 0/2)


Step 1:

  • Add the ‘When a new response is Submitted’ trigger action. It will trigger the flow when a new response is submitted.
  • In the trigger action specify the ‘Form Id‘ of the Microsoft Form.


0


Step 2:

  • Add the ‘Get response details‘ action. This action retrieves a form response.
  • Specify the ‘Form Id‘ of the Microsoft Form
  • For the ‘Response Id‘ add the output ‘List of response notifications Response Id‘ of the ‘When a new response is Submitted’ trigger action.

sue;ap asuodsau

Step 3:

  • Initialize the variables with reference to screenshot below:
    • Initialize variable ‘Counter‘ of type ‘ Integer‘ value 0.
    • Initialize variable ‘Star‘ type ‘String‘.

Intialize variable ‘Feedback‘ of type ‘Integer‘ value ‘int(<Pass the Forms variable of that hold the Star count>)‘.


{x} 
Initialize variable Counter 
• Type 
{x} 
Type 
Counter 
Integer 
Initialize variable Star 
Star 
String 
Enter in itial 
Initialize variable Feedback Integer 
Feedback 
t nteger 
int(—) x


Step 4:

  • Add the ‘Do Until‘ loop and configure it with reference to screenshot below:
    • You can click on ‘Edit in advance mode’ and paste the formula @equals(variables(‘Counter’), variables(‘Feedback’))
  • Add the ‘Append to string variable’, set the ‘Name’ to ‘Star’ and ‘Value’ to
    • <span>☆</span>
  • Add the ‘Increment variable Counter’, set the ‘Name‘ to ‘Counter‘ and ‘Value‘ to 1.


Do until 
Edit in mode 
Change limits v 
is equal to 
{x} 
Append to string variable(Star) 
• Value 
Increment variable Cauter 
Counter 
Add an action


Step 5:

  • Add the ‘Compose‘ action and add the HTML below.
<h2> Feedback</h2>
<h2><div>
@{variables('Star')}
</div></h2>

Compose Star rating


Step 6:

  • Add the Muhimbi ‘Convert HTML to PDF‘ action and pass the output of the ‘Compose‘ action to the ‘Source URL or HTML‘ action.

Conver•t НТЬ.ЛИ to POF 
• НТМ: 
Sh0w ћВ•ппсИ ореол:


Step 7:

  • Add the ‘Send an email(V2)‘ action to the Flow canvas and configure it with reference to details below:
  • To: Email Address.
  • Subject: Order – Testing
  • Body: Click n </> icon and paste the HTML below and  pass the output of the ‘Compose‘ action.
  • Attachments Name -1 -Star Feedback.pdf
  • Attachment Content – Pass the  ‘Processed file Content‘ the output of the Muhimbi ‘Convert HTML to PDF‘ action.

Send an email C02) 
(Send " ) 
StE 
file x 
+ Add 
Hide advsrQd opti.-.s 
nmcrosoft.com 
Email address to send mail from (requires "Send as' or "Send on beh 
Specify email addresses separated by semicolons like someone@con 
Specify email addresses separated by semicolons like someone@con 
Impoünce


Step 8:

All done! Now it’s time to test our Power Automate(Flow).

  • Open the link\URL for the Microsoft Form in the browser and submit a Form.
  • The Flow will be triggered automatically send you an email with ‘Stars’ in the email body and a pdf as an attachment.

Snip of the Email:

test clavin 
Wed 8/26/2020 7:06 PM 
To: test_clavin 
Star Feedback.pdf 
41 KB 
Feedback


Snip of the PDF:

Feedback

If you want to print your Microsoft Forms Response to PDF or Convert the Forms including attachment, refer to the articles below:

Subscribe to this blog for the latest updates about SharePoint Online, Microsoft Flow, Power Apps and document conversion and manipulation.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s