- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2017 09:00 AM
Hello Experts,
I have created auto numbering for existing software model table. The issue is we have few old records for which we need numbering as well but it works only for newly created records. Is there a way to generate numbering for existing records as well. Thank you in advance.
Thanks & Regards,
Jag.
Solved! Go to Solution.
- Labels:
-
Enterprise Asset Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2017 11:49 AM
Sorry change line 6 to gr.u_number so...
var gr = new GlideRecord("cmdb_software_product_model");
gr.orderBy('sys_created_on');
gr.query();
while (gr.next()) {
var nm = new NumberManager('cmdb_software_product_model');
gr.u_number = nm.getNextObjNumberPadded();
gr.autoSysFields(false); // Do not update sys_updated_on, sys_updated_by, and sys_mod_count
gr.setWorkflow(false); // Do not run any other business rules
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2017 11:52 AM
Hello Michael,
I did changed it and tried but no luck.
Thanks,
Jag.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2017 11:56 AM
Since we have no access to your instance to check logs, errors, or see what you are doing, you need to double check the code in the script to make sure the table name is correct on lines 1 and 5, make sure the field name is correct on line 6, etc. If so I don't have any further ideas for you without more information like errors, etc that you are seeing when you execute the script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2017 12:08 PM
Hello Michael,
I checked for the table name ad field name and they are correct. I also don't see any errors while executing the script and every time it just says script is completed. Please let me know if i need to add any logs in the script.
Thanks,
Jag.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2017 12:21 PM
I suggest you execute the same code on a service now developer instance and see if it works. Based on log information My previous script was also not updating your records.
Thanks
Please Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2017 10:36 AM
Hello Alikutty,
Mike's script is working fine in Developer instance but it isn't in our instance. Is there anything that I need to check in our instance for troubleshooting. Could you please help me in getting this done.
Thanks,
Jag.