Form not submitted
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2024 08:56 AM
If incident tasks not close then incident also not close.
I've write this client script for it and used script include also.
But issue is when tasks are close completed then also form is not submitted.
function onSubmit() {
var sysID = g_form.getUniqueValue();
var submit = false;
var ga = new GlideAjax('closeTask');
ga.addParam('sysparm_name', 'checkTask');
ga.addParam('sysparm_value', sysID);
ga.getXMLAnswer(function(response) {
if (response == 'true') {
g_form.addErrorMessage("Task Incidents are not closed.");
submit = false;
} else {
submit = true;
}
});
return submit;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2024 08:59 AM
Hi @nowitsvashu
Plz chk the Incident property which move task to cancel if you try to close the Incident.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2024 10:14 AM
Hi @nowitsvashu ,
You can write a before update Business rule on Incident table and query to child table,
Here i am checking for child incident but according to your requirement please change the table name and query
(function executeRule(current, previous /*null when async*/ ) {
var inc = new GlideRecord('incident');
inc.addQuery('parent_incident', current.sys_id);//in child incident we have parent_incident field which stores parent number
inc.addQuery('active',true);
inc.query();
if (inc.hasNext()) {
gs.addInfoMessage('please close all child task before closing Parent incident');
gs.info('inside if child');
current.setAbortAction(true);
}
})(current, previous);
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang