sc_task work note is mandatory on closed state

hblair
Kilo Expert

Hi all - I have been looking through the wiki to find some help with this.

I have sc_tasks that I want to make work note mandatory when state changes to "closed complete" or "closed incomplete".

I created a ui_policy called "Make work note mandatory on close state".   But when I clicked on the "Close Task" button, the ui_policy didn't work.

Do I need to create a business rule or ui action around the "Close task" button.     If so, can someone give me some direction on how to do so?

Thanks much!

Hank

7 REPLIES 7

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi Hank,



It is possible via UI Policy,


You just need to give proper Condition.


Just Make New UI policy in which Give Condition as Follow:-



state is one of Closed complete, closed, etc (as per ur choice).



Then Go down And select field name as work Notes it will 100 percent work.



Sean has shown you the Screen shot also.


Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi Hank,


See I have one Simple solution for this, as per my understanding you want to update worknotes rite.



So do one thing Just Create UI policy in which write condition as:



State is not closed.



and make worknotes mandatory. so before state gets closed it will populate a message saying that work note is mandatory.



this is what we have done in our instance.



see image below( just in this we have made comments mandatory.) simply u can change it to work notes


find_real_file.png


johnvpr
ServiceNow Employee
ServiceNow Employee

This is one other example:



By editing the default CLOSE TASK   UI action with this example code I was able to make Additional Comments(request_item.comments dot walked)     field required upon submission of Task.


/sys_ui_action.do?sys_id=79cc847bc611227d01a8092813683b36




Name: Close Task


Table: sc_task


action name: close_task


client: checked


onclick: closeTheTask();



Script:


function closeTheTask(){


try {g_form.hideFieldMsg('request_item.comments');} catch(e) {}


g_form.setMandatory('request_item.comments', true);


gsftSubmit(null, g_form.getFormElement(), 'close_task');


}



if (typeof window == 'undefined')


defCloseTask();



function defCloseTask(){


current.state = 3;


current.update();


}