In survey we have some mandatory fields but when error message come how to edit that message

viigate
Mega Contributor

Hello All,

As per below screen shot   you all can see this error message when any mandatory field is not fill, do any one have any idea how to edit this display message when any survey is taken.

find_real_file.png

Thanks & Regards,

Viraj Hudlikar.

1 ACCEPTED SOLUTION

Sumanta Sathua
ServiceNow Employee
ServiceNow Employee

The UI page called assessment_take2 when the user taking the survey . So navigate to   "UI Pages" -> Search by name "assessment_take2" . Open the page and go to the client script .



The function showInvalidFieldsMessage() hold the message that you   can edit to show the   message as you like .



  if (numInvalidResponses > 0) {


  var msg = assessableLabel + ' ' + numInvalidResponses + ' invalid response';


  g_form.addErrorMessage('There are invalid responses in the following areas:');



You can edit the above error message .



Thanks


View solution in original post

5 REPLIES 5

djoodjii
Kilo Expert

Sumanta Sathua
ServiceNow Employee
ServiceNow Employee

The UI page called assessment_take2 when the user taking the survey . So navigate to   "UI Pages" -> Search by name "assessment_take2" . Open the page and go to the client script .



The function showInvalidFieldsMessage() hold the message that you   can edit to show the   message as you like .



  if (numInvalidResponses > 0) {


  var msg = assessableLabel + ' ' + numInvalidResponses + ' invalid response';


  g_form.addErrorMessage('There are invalid responses in the following areas:');



You can edit the above error message .



Thanks


summ Very much thanks for helping me out just one thing this will affect globally as any mandatory message will show same error message can we make it specific as if for one survey i want to use this default message but for some survey i want to use my custom message.


Yes . You can do that by checking sys_id of the survey before   showing the error . You can do that   by



var typeId = gel('type_sysID').value;     // This will give you the sysID   of the Survey . Compare this with the Sys ID of the survey that you want to show specific error to the user .If matches then show your own message .



Ideally you can put the above conditional check in the method   showInvalidFieldsMessage ()   to show different error message   specific to one survey .