Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to scroll to empty 'Resolution notes' field on click of 'Resolve' button in workspace?

Guruvendra J
Tera Contributor

If 'Resolution notes' field is empty and when agent clicks 'Resolve' button in workspace, 'Resolution notes' field should become mandatory and control should scroll to it.

 

I tried with below methods in workspace but no luck.

g_form.showFieldMsg('close_notes', 'Resolution notes are required.', 'error', true); //it works only on onLoad client script.

 

g_form.setMandatory('close_notes', true);
g_form.getControl('close_notes').focus(); //Not setting focus to the field

 

g_form.setMandatory('close_notes', true);
g_form.getControl('close_notes').scrollIntoView(); // it does not wait, setting state to 'Resolved' even though field is empty

 

Any other thoughts would be highly appreciated.

 

When I make the field mandatory with below line of code, 'Resolution notes' label and textbox is not highlighted with red color. When I double click 'Resolve' button, some OOTB script is running and setting 'Resolution notes' label and textbox is highlighted with red color. Can you help me how to achieve this?

 

g_form.setMandatory('close_notes', true);

 

Thanks in advance.

 

Resolution Notes_3.png

1 REPLY 1

omar10148
Tera Contributor

hello @Guruvendra J 

did you find a solution ? i have the same requirement