We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Unable to Set "Work Notes" mandatory for sc_task table

CharanV66187530
Tera Expert

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');

}

1 ACCEPTED SOLUTION

CharanV66187530
Tera Expert

We have to use both Client Script and Script Include to make mandatory. 

View solution in original post

9 REPLIES 9

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
Tera 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 Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

Vishal Jaswal
Tera 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 Expert

@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