3 ways for error handling in Power Automate

While everything is being automated, we will learn how effective you can handle the errors while you automate the process. Ideally when a failure happens in a Power Automate cloud flow, the default behavior is to stop processing. You might want to handle errors and roll back earlier steps in case of failure. Here are 3 basic first hand rules to consider implementing without second thought.

Run after

The way that errors are handled is by changing the run after settings in the steps in the flow, as shown in the following image.

Screenshot showing the run after settings.

Parallel branches

When using the run after settings, you can have different actions for success and failure by using parallel branches.

Screenshot showing the parallel branch with run after.

Changesets

If your flow needs to perform a series of actions on Dataverse data, and you must ensure that all steps work or none of them work, then you should use a changeset.

Screenshot that shows a changeset in flow.

If you define a changeset, the operations will run in a single transaction. If any of the step’s error, the changes that were made by the prior steps will be rolled back.

Special mentions:

  1. Using Scopes – Try, Catch, Finally
  2. Retry policies – Specify how a request should be handled incase failed.
  3. Verify the Power Automate Audit Logs from Microsoft Purview Compliance Portal
  4. Last but not the least – Check the API Limits for the different actions.

Cheers,

PMDY

Calling Command Line Commands from C# – Quick Tip

Hi Folks,

In today’s no code world and AI, while most of the Apps are developed using low code approach, sometimes we have to go with the traditional way of development to handle any integrations with other systems.

When we give anyone Command Line script and ask them to execute, the other person would immediately open Search bar at the bottom available in Windows and start entering cmd. Immediately command prompt window appears and will be able to execute the same command.

But what if we ask to execute command line Commands from C# code…? So, in this blog post, I will show you how easily you can call command line commands with a simple example. Let’s get started…

Here in order to showcase, I will just use a basic command line command and run it from C#.

Everyone knows how to find the ipconfig command right, which just shows the internet protocol configuration when entered in command line like below.

In order to execute it from Console Application using C#, we would need to utilize the System. Diagnostics. You can utilize the below C# code.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
namespace BatchTest
{
class Program
{
static void Main(string[] args)
{
Process pro = new Process();
pro.StartInfo.FileName = "cmd.exe";
pro.StartInfo.CreateNoWindow = true;
pro.StartInfo.RedirectStandardInput = true;
pro.StartInfo.RedirectStandardOutput = true;
pro.StartInfo.RedirectStandardError = true;
pro.StartInfo.UseShellExecute = false;
pro.Start();
pro.StandardInput.WriteLine("ipconfig");
pro.StandardInput.Flush();
pro.StandardInput.Close();
pro.WaitForExit();
Console.WriteLine(pro.StandardOutput.ReadToEnd());
Console.ReadKey();
}
}
}

When we execute this command, it shows exactly same as what we saw above with Command Line.

In the same way we can call any Command Line Commands from C#. I have to use this approach for my Power Platform Implementation integration to decrypt encrypted messages using PGP and I found it to be very helpful and thought of sharing with all of you. If you were looking for a program to decrypt, you can check out for previous blog post here.

Cheers,

PMDY