How do I show a confirmation dialog when a user checks the Work Notes/Additional Comments checkbox

kjmauriello
Mega Expert

I need to show a confirmation dialog when a user checks the Additional Comments checkbox.  The dialog will simply state, are you sure you want to enter customer visible comments.

I have been unable to find a field to put a client script on or any other method of trapping this action.

8 REPLIES 8

Shishir Srivast
Mega Sage

Can you please use onChange client script with confirm() method


confirm('Are you sure you want to enter customer visible comments?');



function onChange(control, oldValue, newValue, isLoading, isTemplate) {


    if (isLoading || newValue === '') {


          return;


    }


    //Type appropriate comment here, and begin script below


        if(confirm('Are you sure you want to enter customer visible comments?'))


        {


                  //Have your rest of the code here


        }


}


That would be great, what field do I put the onchange client script against. I do not see a field for the checkbox






KEVIN MAURIELLO


Sr. Technical Consultant



INSOURCE | 565 E. Swedesford Road, Suite 220 | Wayne, PA 19087


P. 1 610 592 0800 | C. 1 484 695 3645 | F. 1 610 592 0817


kevin.mauriello@insourcenow.com<mailto:michael.hallman@insourcenow.com> | www.insourcenow.com<http://www.insourcenow.com/> | Connect on LinkedIn<https://www.linkedin.com/in/kjmdeveloper>



INSOURCE: Facebook<https://www.facebook.com/insourceinc/> | Twitter | LinkedIn<https://www.linkedin.com/company/insourceinc/>



ServiceNow Gold Services and Sales Partner


Hi Kevin,



You can have some thing like this, need to mention the Field name on which you new to execute the onChange client script while creating the client script.


find_real_file.png


I know that, the Additional Comments field is the actual text field.   I need the client script on the checkbox NOT the text field.   When the onChange is on the Additional Comments field the event fires for every keystroke in the field.   Do you know the field name of the checkbox?   That is what needs to have the onchange client script not the Additional Comments text field.