- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2020 11:15 PM
Hi experts,
A strange behaviour is driving me nuts. I've the following code inside a SI
var task = new GlideRecord('u_my_table');
task.initialize();
task.u_name = "Test";
var sys_id = task.insert();
gs.log(sys_id, "ABC");
The problem here is two fold:
- Logs print the sys_id as null 1 in 50 tries (just a calculated guess)
- Logs print the sys_id as expected the remaining times
So, I wonder what is causing it to fail that one time and if it is possible to know the reason why it failed?
I tried looking at logs (during the timeframe at which the insert happened) and did not find any warning/error level data.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2020 03:12 AM
Hi Nisar,
It's strange.
Do you have any before insert BR on that table or any data policy applied on that table.
Ideally it should give you the sys_id everytime.
If that is the case please raise a HI ticket with ServiceNow if this is for your client instance.
Do let us know the updates.
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
‎07-28-2020 03:12 AM
Hi Nisar,
It's strange.
Do you have any before insert BR on that table or any data policy applied on that table.
Ideally it should give you the sys_id everytime.
If that is the case please raise a HI ticket with ServiceNow if this is for your client instance.
Do let us know the updates.
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
‎07-28-2020 03:42 AM
Do you have any before insert BR on that table or any data policy applied on that table. --> Yes, there are a couple but they do not contain "setAbortAction
" code in them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2020 03:21 AM
Are you running any loop on this script include, and any posibilty that recod is not inserted , I mean any ACL/Duplicate entries restricted condition/policy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2020 03:43 AM
No loops. Record does not get created that is for sure when null is returned.