workflow script - Set field Mandatory

brown9394
Tera Expert

Hello Experts,

Is it possible to set a field on the demand form mandatory through the workflow between tasks? Before task can be closed out, I want 'u_manager' field to be mandatory before a task can be closed. I cannot do this with a UI policy on demand form on state change, because this state has 3 different tasks, and u_manager field needs to be mandatory before the last task closed. Any ideas?

Basically after the 'confirm requested resources' task is completed, we need to set 'u_manager' mandatorybefore 'resources fulfilled' can be completed.

Screen Shot 2016-11-21 at 12.20.50 PM.png

17 REPLIES 17

So we have a business rule running on multiple other tasks on task level that does a check to see if a field is filled in, and if it isn't it does not let you close the task, however, it does not make it mandatory on the form, for which we've used UI Policies. The only problem doing it on the task level is that you won't know to fill in that field unless you try to close it, and it gives you an error.


Kalaiarasan Pus
Giga Sage

I have explained a method here to deal with such issues.



https://community.servicenow.com/message/997066#997066



Give it a try and let me know how it goes. I have tried it on my personal instance and so it should work just fine.


This is really nice but this high level code many people won't be figure out where to place.


Thanks for all the suggestions guys. This seems like an overkill for making a field mandatory from that point on for rest of the workflow. I do have an unique identifier 'task_code' for tasks, would it be possible to run a script on demand when 'Confirm Requested Resources' is 'Closed Complete'? Perhaps in the UI Policy advanced section?


This can be achieved in a simple way.



Create a ui policy and based upon the description make that manager mandatory.




Conditions:


State is Closed complete and Descirption is Resource Fullfilled