workflow script - Set field Mandatory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2016 09:33 AM
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.
- Labels:
-
Scripting and Coding
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2016 12:29 PM
Can you just provide me the demand task table name ?
is it something like dmn_demand_task ? OOB nothing like that exists.
Moreover if we select task type as demand from the workflow demand will be created not the demand task and short description will be populated on the name in the demand form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2016 12:37 PM
yeah ... you got it right, it's 'u_demand_task'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2016 01:02 PM
If u_demand_task record will be created from the workflow, it will be standalone . How you will be associating to a demand then ?
I am not sure how the relationship you established.
There are many ways to make the associated demand manager mandatory.
Write a before update business rule on the demand task . Preferred one
Condtion: current.state.changesTo(3) && current.u_task_code=="Resources Fulfilled"// Closed Complete
Script;
var gr= new GlideRecord('dmn_demand');
gr.addQuery('demand_task', current.sys_id);
gr.query();
while(gr.next()){
if(gr.u_manager.nil()){
gs.flushMessages();
gs.addErrorMessage("Manager is empty in the parent record" + gr.number);
current.setAbortaction(true);
}
}