All Content
Timespan
explore our new search
Power Automate: Step-by-Step Guide to Create a Stack Trace
Image Source: Shutterstock.com
Power Automate
Sep 29, 2023 11:13 AM

Power Automate: Step-by-Step Guide to Create a Stack Trace

by HubSite 365 about Pieter Veenstra [MVP] (SharePains)

Microsoft MVP and Microsoft Productivity Principal Architect at HybrIT Services

Citizen DeveloperPower AutomateM365 Hot News

Explore how to create a stack trace in Power Automate flows, use child flows, and implement the Try Catch Finally pattern.

Power Automate Flows: Creating a Stack Trace

Professional developers are often acquainted with stack traces, a fundamental coding concept. The idea of integrating this concept into Power Automate is something discussed in this post authored by Pieter Veenstra. He explores the possibility of creating a stack trace within the low-code landscape.

A stack trace can display the sequence of function calls preceding the current function in conventional coding. This piece explores how to implement this idea within Power Automate, a Microsoft tool used to automate workflow processes.

Picture a scenario where you have two flows (Flow 1 and Flow 2). Both these flows call a child flow that, in turn, call another child flow. The third child flow fails sporadically. Understanding whether it was Flow 1 or Flow 2 that initiated the child flow could prove beneficial.

In the parent flows, Pieter explains, you are likely to want to use the Try Catch pattern. From the parent flow, a child flow is called. Each child flow has an input property named ‘Stack.’ In this ‘Stack’ property, the code includes the flow's display name and the URL directing to the flow run.

Pieter then implements a similar method when calling the second child flow from the first level child flow, thus building on the stack trace. This includes the incorporation of a date/time stamp.

In the final third flow, this pattern is reiterated. Here, an email is sent out indicating the failure details, along with the built-up stack trace. As a result, the received email will contain a stack trace with all the flow run details.More Information

The concept of organizing the stack trace a little more can be implemented easily, considering it a detail.

Main Topic Discussion

The utilization of Power Automate for creating a stack trace is a fusion of traditional coding elements with modern automation capabilities. This is significant in troubleshooting errors within a complex workflow. It emphasizes the flexibility and broad functionality of Power Automate, thereby underlining its reliability and crucial role in delivering effectively automated workflow processes. Accurate error detection assists in optimizing processes and improving their efficiency, highlighting the tool’s potential contributions to business productivity.

Read the full article Create a stack trace in Power Automate flows

Power Automate - Power Automate: Step-by-Step Guide to Create a Stack Trace

Learn about Create a stack trace in Power Automate flows

Creating a stack trace within the realm of Power Automate involves the creation of numerous flows. The complexities surrounding professional developers are not alien to the concept of stack traces. The nuances of such an idea can be embedded within the low code scenario quite effectively.

  • Creating the stack trace involves parent and child workflows. In automating processes, the usage of child flows is quite prominent.

The introduction of "Try Catch Finally," a pattern introduced half a decade ago, has brought about more profound thought processes about stack traces. One interesting aspect being the notion of passing Parent flow URLs to child flows.

  • Imagine a scenario; two flows, namely Flow 1 and Flow 2, these call a Child flow, which in turn calls for another child flow. Occasional failure of the 3rd Child Flow presents the challenge of finding out the source of initiation. One may need to figure out if it was Flow 1 or Flow 2 that prompted the process.

The implementation of flows often omits the Try Catch pattern for simplicity, but you may want to consider it in this context. The following elements could be noted when creating child flows:

  • All child flows tagged with an input property known as Stack.

The concept of "Stack" property includes the flow display name and URL using the following code. A comma separates these fields:

  • @{workflow().tags.flowDisplayName}, @{concat('https://make.powerautomate.com/environments/', workflow()?['tags']['environmentName'], '/flows/', workflow()?['name'], '/runs/', workflow()?['run']['name'])}.

To further the Stack trace, the first child flow can call another child flow. In this, one could adopt the Stack input property, similar to the previous flow calls. The process increases the build-up of the Stack trace with an added feature of a date/time stamp.

  • @{triggerBody()['text']}@{workflow().tags.flowDisplayName}, @{concat('https://make.powerautomate.com/environments/', workflow()?['tags']['environmentName'], '/flows/', workflow()?['name'], '/runs/', workflow()?['run']['name'])}, @{utcNow()}

Transitioning to the 3rd child flow, you could replicate this pattern but now with an informative email about failure details, including the stack. Format the stack trace for better readability, but this does not overshadow the essence and achievement of having implemented a stack trace.

You can revisit this concept multiple times, consolidating the understanding of Power Automate. The comprehension could be complemented by various online training courses available on Microsoft Learn. These would provide you a comprehensive understanding of low code and no-code solutions.

More links on about Create a stack trace in Power Automate flows

Create a stack trace in Power Automate flows
Mar 31, 2023 — In the pro code world a stack trace can show you which functions/procedures/methods are being called before the current function. In this post ...
Create a stack trace in Power Automate flows
Apr 8, 2023 — The stack trace is a well known concept in pro code development. Can we take this idea and use it in low code platforms like Power Automate? In ...
Create a stack trace in Power Automate flows
The stack trace is a well known concept in pro code development. Can we take this idea and use it in low code platforms like Power Automate?

Keywords

Power Automate stack trace, create stack trace, Power Automate flows, debug Power Automate, Power Automate error tracking, generate stack trace, Microsoft Power Automate, Flow stack trace, trace management Power Automate, Power Automate exceptions.