web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Store error messages a...
Power Automate
Answered

Store error messages and location in database

(0) ShareShare
ReportReport
Posted on by 170

Hello everyone,

 

In my flow I am capturing whenever an error occurs and storing it in a list this way

TelmoERF96_0-1700736167154.png

And when I expand each item on the list I get something like this, like this I can only insert the location into the table

TelmoERF96_1-1700736227904.png

I am using a For Each to insert each line of the list into my table in SQL Server this way

TelmoERF96_4-1700738532280.png

But this way I only insert the Location, how can I manipulate the Error so I can insert both the Location and the Error Message?

 

Thanks in advance,

 

Telmo Ferreira

  • Verified answer
    Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    The %Error% variable that you get via the Get last error action is actually an object and you can access the values in it as properties of the object. 

    So, if you have it as %CurrentItem%, you can access the name of the sub-flow as

    %CurrentItem['SubflowName']%, the action index as %CurrentItem['ActionIndex']% and the message itself as %CurrentItem['Message']%.
     
    However, I would suggest using Replace text on the message to replace newlines (enabling regular expressions and using \r?\n as the pattern) with an empty string or a whitespace. It might be that the newlines are causing issues with your SQL insert.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • UshaJyothiKasibhotla Profile Picture
    225 Moderator on at

    use a query as following

     

    Insert into Table name (coloumnname1,coloumnname2)

    values('value1',value2)

     

    Here coloumn names and values must be changed as per your Input file

     

    Hope this helps

    Usha.

  • TelmoERF96 Profile Picture
    170 on at

    @Agnius I used your first suggestion, it worked perfectly for what I intended

     

    Thank you

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 227 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 221 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 132

Last 30 days Overall leaderboard