What is the use of insertLazy() in GlideRecord?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2019 11:13 PM
Hi,
I was going through one of the OOB script includes : PerspectiumLogger,
when I came across the use of lgr.insertLazy() for var lgr = new GlideRecord("u_psp_log_message") in log function.
Could you please explain the difference between insertLazy and insert methods in GlideRecord?
Thanks!
- Labels:
-
Best Practices
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2019 01:38 AM
HI Pranshu
This seems to be an undocumented (and maybe legacy) function.
I just can imagine, speaking of logging functions, that the record will not be saved to the DB immediately.
There are other DB Systems on the market, where a "lazy-writer" takes records from the transaction log to the DB file, only when there is no heavy load on the database.
For me, it looks to something like that.
I would recommend NOT to use it in your scripts, as it is undocumented, and I cannot find any useful information on that in the docs, etc.
If this answers your questions or is helpful, give me a vote.
BR
Dirk

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2019 10:47 PM
Hi
If you need more information on this issue, just let me know.
If your question was answered with my reply, please mark as correct and close this question.
Thanks & BR
Dirk

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2019 10:51 PM
You'd need to raise a case on HI to get an official response around this undocumented function.
I've never heard of it before.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022