- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2020 01:10 AM
Hello,
I am having issues with gr.isActionAborted(). Even though my update does NOT go through, gr.isActionAborted() returns false. Weirdly, when logging gr.update(), it returns null... I logged it like this. This code snippet is placed within an if-statement checking that grTask.isValidRecord()
grTask.update();
gs.info("grTask: " + grTask.update());
gs.info("is action aborted?" + grTask.isActionAborted());
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2020 01:42 AM
Hi,
see image below
1) I have 1 Before BR which blocks the update
So isActionAborted() -> gave true
I deactivated the BR and
So isActionAborted() -> gave false
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2020 01:15 AM
Hi,
please share complete script
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2020 01:18 AM
var task_id = this.getParameter('sysparm_task_id') + '';
var billing_type = this.getParameter('sysparm_billing_type') + '';
var billable = this.getParameter("sysparm_billable") + '';
var billing_reference_1 = this.getParameter("sysparm_billing_reference_1") + '';
var billing_reference_2 = this.getParameter("sysparm_billing_reference_2") + '';
var billing_reference_3 = this.getParameter("sysparm_billing_reference_3") + '';
var chg_task_type = this.getParameter("sysparm_chg_task_type") + '';
gs.log('server - update task: ' + task_id);
gs.log('server - update billing type: ' + billing_type);
var bSuccess = true;
var grTask = new GlideRecord('task');
grTask.get(task_id);
if(grTask.isValidRecord()){
if (grTask.getValue("sys_class_name") == "incident" || grTask.getValue("sys_class_name") == "sc_req_item") {
grTask.setValue('u_billable_task',billable);
}
else if (grTask.getValue("sys_class_name") == "change_task") {
grTask.setValue("u_billing_type_task",billing_type);
}
else if (grTask.getValue("sys_class_name") == "change_request") {
grTask.setValue("u_billing_reference_1",billing_reference_1);
grTask.setValue("u_billing_reference_2",billing_reference_2);
grTask.setValue("u_billing_reference_3",billing_reference_3);
if (chg_task_type == "standard" || chg_task_type == "standard_tasks") {
grTask.setValue("u_billing_type_task", billing_type);
}
else {
grTask.setValue("u_billable_task",billable);
}
}
gs.info("is action aborted?" + grTask.isActionAborted());
grTask.update();
gs.info("grTask: " + grTask.update());
gs.info("is action aborted?" + grTask.isActionAborted());
if(grTask.isActionAborted()){
bSuccess = false;
}
}
gs.log('server - returning: ' + bSuccess);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2020 01:25 AM
Hi,
isActionAborted returns false which means your grTask update is working fine.
If it returns true, then it means that your operation is aborted.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2020 01:32 AM
Did you check record got successfully updated or not?
if it gets updated properly it means that function would return false
if record not gets updated then that function would return true
Did you check any before update BR is restricting the update operation?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader