Show Custom Error Message in CRM Portal


While working on Dynamics 365 Portal, We all have observed an error message is displayed like below when an error occurred in Portal Add-on.

\”We\’re sorry, but something went wrong. Error ID #[]\”

\”An unknown failure has occurred. Error ID # []\”

But they\’re quite unclear, so users cannot take any action based on this message. GUID doesn\’t help.

If there\’s certain contact such as e-mail address of Portal admin, the error message should contain this information and suggest to contact to admin.

These type of errors usually comes when any CRM Plugins/Workflows throw the Server-Side error while processing the Portal requests.

Currently, Microsoft has not provided any direct way to customize this error message. Though a lot of people submitted their ideas on Microsoft Idea Portal to addon this feature in upcoming portal releases.

https://ideas.dynamics.com/ideas/dynamics-crm/ID0000538

Solution:

Though we do not have any direct way to achieve this, so I have written 2-3 lines of script. Using that you can show the user-friendly error message to the portal users.

$(window).load(function()
{
      // You just need to Change the error message only

      var errorMessage = \”We\’re experiencing an internal server problem. Please try again later or contact support@help.com\”;
     
      $(\’.text-danger\’).html(\’&nbsp\’+errorMessage);

});

In the above code, you just need to change the error message and paste the whole code inside Custom JavaScript section of the Web page.









Demo:


Published by arpitpowerguide

My name is Arpit Shrivastava, who is a Microsoft MVP in the Business Applications category. I am a Microsoft Dynamics 365 and Power Platform enthusiast person who is having a passion for researching and learning new things and acquiring immense knowledge. I am providing consistent help, support, and sharing my knowledge through various Social Media Channels along with my Personal Blog, Microsoft Community, conducting online training and attending various 365 Saturday Events worldwide and sharing the best Solutions to the readers helping them achieve their goals and objectives in Customer Relationship Space.

One thought on “Show Custom Error Message in CRM Portal

  1. Hi Arpit, this is a great post. But for some reason, I'm not able to make it work. I'm trying to display a custom error on triggering a WF (when the WF is cancelled). Any help reg this is much appreciated!!!Thanks,Dhivya

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: