
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Dear fellow developers or concerned ServiceNow team addressing it,
I am reporting a bug here.
The documented .find() method on ServiceNow GlideRecord API does not work.
It is intended to return a true/false, but the key part is it moves to the first record that matches the find 'value' parameter. BUT, instead....
It creates a duplicate incident with the same Incident number.
var GR = new GlideRecord("incident");
GR.query();
if (GR.find("number", 'INC0009003')) //KEY PART - YOU FETCH THE GlideRecord object on the queried record.
{
gs.print("Short description: " + GR.short_description);
GR.short_description = "UPDATED" + GR.short_description; GR.update();
gs.print("Updated Short Description: "+ GR.short_description);
} else {
gs.print("Incident not found!");
OUTPUT:
Fig: A new duplicate record every time, the script is run, the reason .find() method.
When the above code is executed, as per the API documentation, it is expected that the relevant record is fetched and is updated via the GlideRecord object. BUT.... this creates a record and that too a duplicate incident even with the same incident number.
Please fix it.
Regards,
Anish Reghu
- 1,940 Views
- « Previous
-
- 1
- 2
- Next »
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.