
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2016 08:15 AM
I tried creating a new Inbound Action for a custom task type that we have and the script seems to be giving some errors.
The script is as follows. It is the same as the "Update Incident", "Update Problem", etc. scripts that came with ServiceNow originally:
gs.include('validators');
if (current.getTableName() == "my_custom_task_table_name") {
current.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
if (gs.hasRole("itil")) {
if (email.body.assign != undefined)
current.assigned_to = email.body.assign;
if (email.body.priority != undefined && isNumeric(email.body.priority))
current.priority = email.body.priority;
}
current.update();
}
Except I am seeing errors in the logs that say:
org.mozilla.javascript.EcmaError: "isNumeric" is not defined.
Caused by error in <refname> at line 1
==> 1: gs.include('validators');
2:
3: if (current.getTableName() == "my_custom_task_table_name") {
4: current.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
AND
org.mozilla.javascript.EcmaError: "isNumeric" is not defined.
Caused by error in Inbound Email Actions: 'Update Ad Hoc Request' at line 14
11: gs.warn("current.assigned_to = "+current.assigned_to, "Inbound debug") ;
12: }
13:
==> 14: if (email.body.priority != undefined && isNumeric(email.body.priority)) {
15: current.priority = email.body.priority;
16: gs.warn("current.priority = "+current.priority, "Inbound debug") ;
17: }
Where am I going wrong? Why does the same script work just fine for Incident but not for my custom task type?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2016 08:58 AM
My apologies to all who have been so helpful and patient... I'm not sure how to add a comment so that you're all notified but I just figured out the problem. I completely forgot about the Application scope and am working in a different Application scope than Global.
validator script includes is only present in the Global application scope.
If I copy the validator script in my application scope and include the copy that I made, everything works as expected.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2016 08:58 AM
My apologies to all who have been so helpful and patient... I'm not sure how to add a comment so that you're all notified but I just figured out the problem. I completely forgot about the Application scope and am working in a different Application scope than Global.
validator script includes is only present in the Global application scope.
If I copy the validator script in my application scope and include the copy that I made, everything works as expected.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2016 09:00 AM
Hi Nia,
Glad to know you found out the Root cause and I also didn't know it would work only in global scope.
Regards,
Vikas