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.

 

 

2 REPLIES 2

Tanushree Maiti
Giga 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 mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

Yogesh11bhatt
Tera Expert

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.