0

You’re connecting a SharePoint “Inventory” list to a Canvas app and calling a Power Automate flow, but you want the app to show a friendly error when something goes wrong.

power automate return error message to powerapps
power automate return error message to powerapps

The simple pattern is: your flow always sends a response back, even on failure, and your Canvas app reads that response and decides what to show. In Power Automate, finish your flow with “Respond to a PowerApp or flow.” Give it three outputs named something like success (Boolean), code (Text), and message (Text). Build your flow like a mini try/catch: do the normal SharePoint work in one Scope, and if anything in there fails, branch to a small “catch” area that composes a readable error message. For example, after a failed “Create item” or “Update item,” you can add a Compose with text such as concat('Inventory update failed. Please check the item and quantity. Details: ', outputs('Update_item')?['body']?['error']?['message']). On the success branch, send Respond with success = true, code = “OK”, message = “Saved.” On the error branch, send Respond with success = false, code = “FLOW_ERROR”, message = the output of your Compose. If you ever want the entire call to be treated as a hard failure (for example, for testing), you can add a Terminate action set to Failed, but only do that after you’ve already used Respond if you still want to pass a custom message back.

In your Canvas App, you’ll call the flow and handle the returned record. Canvas Apps use the Power Fx language, which is the formula language you write in properties like OnSelect or Visible. It’s similar to Excel formulas but focused on app behavior, data calls, and UI logic. Here’s a clear pattern you can drop into a button’s OnSelect. First, you’ll see a version that expects your flow to always Respond with success, code, and message; then a version that also catches true connector failures using IfError. These are Power Fx formulas written “In your Canvas App.”

// In your Canvas App (Canvas Apps Power Fx language)
// Call the flow and capture its response record
Set(
    _res,
    MyInventoryFlow.Run(
        ItemIdInput.Text,        // for example, the SharePoint item id or SKU
        Value(QuantityInput.Text) // a numeric quantity to adjust
    )
);

// If the flow responded with success=false, show the message as an error.
// Otherwise, show a success toast.
If(
    !_res.success,
    Notify(_res.message, NotificationType.Error),
    Notify("Inventory saved.", NotificationType.Success)
);

If you sometimes use Terminate in the flow or something unexpected throws an unhandled error, wrap the call with IfError so your app can still show a friendly message:

// In your Canvas App (Canvas Apps Power Fx language)
// Catch connector errors as well as read your custom response when available
IfError(
    Set(
        _res,
        MyInventoryFlow.Run(
            ItemIdInput.Text,
            Value(QuantityInput.Text)
        )
    );
    Notify(FirstError.Message, NotificationType.Error)
);

// If the call succeeded and you got a response, still honor your custom success flag.
If(
    IsBlank(_res),
    /* Do nothing here because we already showed a connector error above */,
    If(
        !_res.success,
        Notify(_res.message, NotificationType.Error),
        Notify("Inventory saved.", NotificationType.Success)
    )
);

That’s the whole loop. The flow always sends back a small, consistent payload with success, code, and message; the Canvas app reads it and decides what to show. For an inventory scenario, this makes it easy to surface helpful errors like “Item not found,” “Quantity must be a number,” or “You don’t have permission to update this list,” without dumping raw technical text on your users.

Have a Question ?

Fill out this short form, one of our Experts will contact you soon.

Call Us Today For Your Free Consultation