How to changeOOB Record not found Message

Brijmohan
Tera Contributor

Hi All,

 

I wrote a one before query BR on Procurement case table. User can see only those record if they are part of the assignment group. 

If I will create a record from user that is not part of assignment group and submit the record, it say record not found because of BR.

Can we modified this message "Record not found" only for this BR.

 

Thanks in advance!

3 REPLIES 3

Amit Gujarathi
Giga Sage
Giga Sage

HI @Brijmohan ,
I trust you are doing great.

  1. Go to the ServiceNow instance and log in as an administrator or a user with the necessary permissions to modify Business Rules.

  2. Navigate to the Business Rules section. You can find it by going to "System Definition" -> "Business Rules" in the application menu.

  3. Search for the Business Rule that you created for the Procurement case table. Make sure to find the exact one that you mentioned in your query.

  4. Open the Business Rule for editing. Look for the script that displays the "Record not found" message when the user is not part of the assignment group.

  5. Modify the script to change the error message to something more appropriate. For example, you could change it to "You are not authorized to view this record."

(function executeRule(current, previous /*, g*/) {
   // Add your existing script logic here

   // If the user is not part of the assignment group, display a custom error message
   if (!current.assignment_group.getRefRecord().getMembers().contains(gs.getUserID())) {
      gs.addErrorMessage("You are not authorized to view this record.");
      // You can also use 'gs.addInfoMessage()' if you want to display an informational message instead.
   }

   // Add any other logic or actions you need to perform in the Business Rule

})(current, previous);

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



Hi @Amit Gujarathi ,

 

Thanks for your prompt response and detailed explanation. I am getting Record not found message OOB not from my BR.

Please find below logic that I have written but not working for message. It is still giving record not found. 

 

Brijmohan_8-1684758543531.png

Brijmohan_10-1684758618899.png

Thanks.

Hi @Brijmohan ,
This a system level configuration , which we cant alter.


Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi