Creating alert message for post button for Additional comments and worknotes

Soham4
Tera Contributor

Hello All,

Whenever the assigned to user is trying to put some comments either under additional comments or work notes field, and they hit "Post" to post their comment. I am trying to create an alert message once they click on post button.

 

Is it possible to do it. Any help is much appreciated.

Thanks in advance,

Soham

1 REPLY 1

Akshay Gupta2
Kilo Sage

Hi @Soham4 

I understand you want to display alert message on Worknote Post button cliick. For this you can check this post on community. I believe you might find your answer. You might have to work with some DOM manupulations.

Link: https://www.servicenow.com/community/developer-forum/how-to-attach-an-onsubmit-script-to-work-notes-...

And for simply saving or updating record you can implement client script.

 

2.

Client script of type onSubmit. on the table. and you can have a small script that check comments field or worknote field is not empty than only it shows alert message

 

function onSubmit() {
   //Type appropriate comment here, and begin script below
        var workNotesValue = g_form.getValue('work_notes');
		var comments = g_form.getValue('comments');
		
     if (workNotesValue !="" || comments!="") {

            alert('Message');
            g_form.clearMessages();
            
    }  
}

 

 

Regards,

Akshay