API
Version 7.x > API > Custom error message in CMSDesk View modes: 
User avatar
Member
Member
johnz02-hotmail - 4/30/2013 6:37:25 AM
   
Custom error message in CMSDesk
Hi all

I’m currently creating a class (under \App_Code) to perform some business logic for a Document_Insert_Before event. The business logic checks if a input Email exists, it shows a customized error message if it exists. I want to display this error message in the build-in red error box under CMSDesk (pls see screenshot here http://oi40.tinypic.com/2ai56c7.jpg) So instead of showing “An error orrcurred…”, I want to display my customized text within the red block. Can you please let me know how to do it, Do I need to throw a type of CMS exception so that it can be captured by CMSdesk ?

I tried “throw new System.ApplicationException("test error message");” But nothing happened.

Thanks a lot

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 4/30/2013 8:22:20 AM
   
RE:Custom error message in CMSDesk
Simply try
throw new Exception("Your message here");

User avatar
Member
Member
johnz - 4/30/2013 11:34:14 AM
   
RE:Custom error message in CMSDesk
Hi FroggEye,

Thanks for your reply.

throw new Exception("test message") leaves an entry in Event log with customized error. However the pop up error message in the red box still shows "An error occurred...." not "test message". Is there a way to pass this message to the pop up error message box ?

Thanks for the help.

User avatar
Kentico Support
Kentico Support
kentico_radekm - 5/6/2013 7:50:05 AM
   
RE:Custom error message in CMSDesk
Hello.

You can replace the resource string cmsform.errorduringsave to your required error message in ~/CMSResources/CMS.resx file. It is a file which contains resource strings of Kentico CMS which represent all messages that can be displayed in CMS Desk and also on live site.

Best Regards,
Radek Macalik

User avatar
Member
Member
johnz - 5/6/2013 1:04:08 PM
   
RE:Custom error message in CMSDesk
change of CMS.resx file is like a hard-coded solution as it will display the same cusom error text for all document save events. I need to display different error messages depends on different senarios. Is there a way that I can pass dynamic error messages to the pop up box ? Thanks

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 5/6/2013 4:07:25 PM
   
RE:Custom error message in CMSDesk
Take a look here, unfortunately not in this version.

User avatar
Member
Member
Lokendra Jain - 5/29/2013 8:48:55 AM
   
RE:Custom error message in CMSDesk
Hi Radek Macalik,

I have a aspx page in my project, i am using custom code. i want to show the error message like kentico cms shows. I am using following code .
ShowError("Record already exists.");

I am getting this error:- [CMSPage.ShowMessage]: Missing messages placeholder on a page or master page.

Could you please suggest me.

Thanks
Lokendra Jain

User avatar
Kentico Support
Kentico Support
kentico_radekm - 6/16/2013 6:27:51 AM
   
RE:Custom error message in CMSDesk
Hello.

Regrettably, it seems this functionality is not supported for standard content. In current version it is supported only in certain UI parts. Our developers will consider better support for this functionality for future release.

Best Regards,
Radek Macalik