Need to make close note mandatory when sc task are closed skipped on Request item.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2023 04:55 AM
Hi
We had requirement like when last task of sc_task state to closed skipped the sate should not change and error should display like fill close notes should be mandatory on req item. we tried BR and UI polices we are getting output like sc_task is closed skipped and Request state wont change to closed skiped once we change the state of request to closed skipped then work notes showing mandatory. see below screen shot for reference.
when i change last task to closed skip its not showing close notes mandatory but also request state is not changed to closed skip and close note not showing mandatory.
Now when i change request state to closed skip the close note will mandatory. But our requirement is when last task is closed skipped the state should not change and need to show close note mandatory on req. Please help who can we achieve. For reference i am attaching workflow also.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2023 08:55 AM
It sounds like you want to require a close note and set the state on the Request when the last SC Task is closed skipped?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2023 03:58 AM
yes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2023 09:28 AM
write a onload client script on 'sc_req_item' table
function onLoad() {
var id = g_form.getValue('sys_id');
var gar = new GlideAjax('checkSkipTasks');
gar.addParam('sysparm_name', 'getData');
gar.addParam('sysparm_id', id);
gar.getXML(getdata);
}
function getdata(trigger) {
var answer = trigger.responseXML.documentElement.getAttribute('answer');
if (answer == true) {
g_form.setMandatory('close_notes', true);
}
}
script Include: make sure client callable is true
var checkSkipTasks = Class.create();
checkSkipTasks.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getData: function() {
var req = this.getParameter('sysparm_id');
var gr = new GlideRecord("sc_task");
gr.addQuery("request_item", id);
gr.addQuery('state',!= 7);
gr.query();
if(gr.hasNext()){
return false;
}else{
return true;
}
},
type: 'checkSkipTasks'
});
Thanks,
Bharath
Bharath Chintala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2023 07:12 AM
Hi Bharath,
I tried client script and script include but still it's not working. Can you please provide an alternative solution?