Unable to Set "Work Notes" mandatory for sc_task table

CharanV66187530
Tera Contributor

Hi @everyone,

Can any one help me on how to make mandatory "work notes" in sc_task table by using UI action. I tried i am able to set "Notes" section instead "work Notes".

function onclieck(){

g_form.setmandatory('work_notes');

}

7 REPLIES 7

Ankur Bawiskar
Tera Patron

@CharanV66187530 

your code should be proper and UI action should be client side

g_form.setMandatory('work_notes', true);

šŸ’” If my response helped, please mark it as correct āœ… and close the thread šŸ”’ā€” this helps future readers find the solution faster! šŸ™

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Tanushree Maiti
Kilo Patron

Hi @CharanV66187530 

 

Create a new UI policy on sc_task table to make Work Notes Mandatory when State Changes to Closed Complete .

  • Ensure in your UI Policy , OnLoad checkbox is False
  • Add UI Policy condition as request Item.cat Item is <your catalog item>

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

Vishal Jaswal
Giga Sage

Hello @CharanV66187530 

 

If you can share your use-case then maybe alternative solutions can be proposed however if you really need code for UI Action to work as client side, then use below and ensure no spelling mistakes:

 

function onClick() {

g_form.setMandatory('work_notes', true);

if (!g_form.getValue('work_notes')) {
g_form.showFieldMsg('work_notes', 'Work Notes is mandatory', 'error');
return false;
}

return true;
}

 


Hope that helps!

CharanV66187530
Tera Contributor

@Vishal Jaswal @Tanushree Maiti @Ankur Bawiskar , I have written correct format by using UI Action but not able to make 'work_notes'. The Ui action making "Notes" section mandatory. Kindly help on this.
Created UI Action on "sc_task" table