To customize the error message after clicking Save in the sys_report_template.do

Malathi3
Tera Contributor

Is there any way to customize the error message after clicking 'Save' or 'Insert' or 'Insert and Update' in the sys_report_template.do. Please find the attached screenshots.

 

Customer want to customize the error message into a meaningful context so that the end user can understand what to do next. 

 

Please help us.

 

 

5 REPLIES 5

Tanushree Maiti
Tera Patron

Hi @Malathi3 

 

Try this. You can keep the meaningful error message in sys_properties ( so that you can change it anytime) and from server side you can read it and display at client side.

 

1: Create a Display Business Rule

  • Navigate to System Definition > Business Rules.
  • Click New.
  • Fill in the following:
    • Name: Custom Report Message Interceptor
    • Table: sys_report_template
    • Advanced: Check the box.
    • When to run: Select display.
  • In the Advanced tab, add a script

(function executeRule(current, previous /*null when async*/) {

   

    if (<add your condition here>){

        g_scratchpad.customReportError = "Your custom error message goes here.";

    }

})(current, previous);

 

 

  1. Create an onload Client script
  • Navigate to System UI > Client Scripts.
  • Click New.
  • Fill in the following:
    • Name: Display Custom Report Error
    • Table: sys_report_template
    • Type: onload
    • Isolate script: false 

function onLoad() {

    if (g_scratchpad.customReportError) {

        g_form.clearMessages();

        g_form.addErrorMessage(g_scratchpad.customReportError);

    }

}

 

 

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

Yogesh11bhatt
Kilo Guru

Hi @Malathi3 , 

 

You can customize the messages , the OOB messages are coming from 'sys_ui_message' table , You can search for the exact error in the message field and you can choose application as 'reporting'.  in the filter condition. you can customize that thing.

Other way is you can write a business rule for this.


Please mark this response as helpful if it guided you in the right direction.

 

Hi Yogesh,

 

We are able to create BR for sys_report table. But we are not able to select 'sys_report_template' in the Business Rule that's why we are facing this error.

Did you tried to customize the OOB messages which were  are coming from 'sys_ui_message' table.