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 Pages / How to capture error i...
Power Pages
Unanswered

How to capture error in PowerApps Portals while Creating a new record

(0) ShareShare
ReportReport
Posted on by 499

Greetings everyone. I am trying to create a record in Dataverse from PowerApps portals using Web API. Since these calls are async in nature, I put my code in try and catch the block to capture the error. Still, unable to capture the error. In the console, I can still error related to the web API call made. Any references or inputs are appreciated, thank you!

try
	{
		var record = {};
		record["xxxxxx"] = "DAta";

		webapi.safeAjax({
			type: "POST",
			contentType: "application/json",
			url: "/_api/xxxxxxx",
			data: JSON.stringify(record),
			success: function (data, textStatus, xhr) 
			{
				var newId = xhr.getResponseHeader("entityid");
				console.log(newId);
				$("#txtShowMessage").text("Record is successfully created.");
				$('#Modal').modal('show');
			},
			error: function (xhr, textStatus, errorThrown) 
			{					
				console.log(xhr);
			}
		});
	}
	catch(error)
	{
		$("#txtShowMessage").text("Sa");
	 $('#Modal').modal('show');
	}

 

Categories:
I have the same question (0)
  • Conway Profile Picture
    120 on at

    Have you created Webapi/error/innererror in Site Settings in Portal management? If not, please make sure you do that.

    https://learn.microsoft.com/en-us/power-apps/maker/portals/web-api-overview#site-settings-for-the-web-api

     

    You can also use Chrome Developer Tool, in the Network tab, check any error info returned by the ajax call.

  • saveri Profile Picture
    138 on at

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
rezarizvii Profile Picture

rezarizvii 55

#2
11manish Profile Picture

11manish 48

#3
Valantis Profile Picture

Valantis 46

Last 30 days Overall leaderboard