Creating Logs for Every Action in Power Automate Creating Logs for Every Action in Power Automate
Wishv Prajapati

Wishv Prajapati

February 05, 2024

All Post
flow-img
Share:

The process of “creating logs for Power Automate instances” involves systematically recording and archiving essential information about each step and action taken during the execution of automated workflows. This comprehensive log becomes an asset, offering users insights into the intricacies of their workflows, enabling efficient troubleshooting, and facilitating performance analysis.

In this blog post, we explore the significance of creating logs for Power Automate instances and how it transforms into a practice for users seeking a deeper understanding of their automated processes. Imagine having a detailed record of when a workflow starts, the events that trigger its execution, the data it processes, and the outcomes it produces—all neatly documented for reference. This level of visibility not only enhances troubleshooting capabilities but also empowers users to optimize and refine their workflows for peak efficiency.

Step: 1 First Add the “When an item is created action and add the Site Address and List Name.

 

img-01

 

Step: 2 Next, add another Compose action to retrieve the workflow URL. Add the expression for get the URL in SharePoint Online.

We need to concat following string in the compose action

String 1: Environment URL (Region needs to be changed as per tenant configuration)
https://asia.flow.microsoft.com/manage/environments

String 2: Environment Name
workflow().tags.environmentName

String 3: “Flows”

String 4:WorkFlow Name
workflow().name

String 5: “Runs”

String 6: Workflow Run Name:
workflow().run.name

concat(‘https://asia.flow.microsoft.com/manage/environments/’, workflow().tags.environmentName,’/flows/’, workflow().name, ‘/runs/’, workflow().run.name)
img-02
Step: 3 Add the “Create Item” action and include the site name and site URL for when users want to upload logs to the list in SharePoint Online.
Title: Include the dynamic “Title” obtained from the “When an item is created” action.
WFItem URL: Add the dynamic value “Output” obtained from the “Compose 2” action.
Stage: Here is the manually added “Pending by Stage 1.”
Assigned To: Enter the Assigned To user email.
Associated List ID: Add the dynamic “ID” obtained from the “When an item is created.”
Status: Include the dynamic “Status Value” obtained from the “When an item is created.”
Created By Original Claims: Add the dynamic “Created by Claims” obtained from the “When an item is created.”
Modified By Original Claims: Add the dynamic “Modified by Claims” obtained from the “When an item is created.”
img-03
Step: 4 Add the “Start and wait for approval” action.
  • Approval type: Add the approval type which you want to choose in the choice value.
  • Title: Added the Title
  • Assigned to: Added the username which you want to send for approval.

 

img-04

 

Step: 5 Next, include the condition action and add the dynamic “Outcome” obtained from the “Start and Wait for Approval” action. Ensure it is equal to “Approve,” as shown in the screenshot below.

 

img-05

 

Step: 6 Again, add the “Create Item” action in both sides “If Yes” and “If No.”

Approve By Display Name: Add the dynamic content “Responder display name” obtained from the “Start and Wait for Approval” action. This action is automatically applied in the “Apply to each” loop.

Comments: Add the dynamic content “Responses Comments” obtained from the “Start and wait for Approval” action.

 

img-06

 

Step: 7 Create a new entry in the SharePoint list and verify the flow.

  • Below is a screenshot of the Workflow History list, where we create a log. It displays all the column values that we add in the “Create Item” action in Power Automate.

 

img-07

Leave a Reply

Your email address will not be published. Required fields are marked *

Want to talk?

Drop us a line. We are here to answer your questions 24*7.