when should i use dot walking and when should i use gliderecord in client script?

SNOW39
Tera Expert

when should i use dot walking and when should i use gliderecord in client script?

6 REPLIES 6

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Basically you should never use GlideRecord in Client Script. Just bad practice.

Maybe this is some interesting reading for you:
2020-01-10 Client Side Scripting: Go for GlideAjax (with getXMLAnswer)!

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020-2022 ServiceNow Community MVP
2020-2022 ServiceNow Developer MVP

---

LinkedIn
Community article, blog, video list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Hitoshi Ozawa
Giga Sage
Giga Sage

Hi SNOW,

As Mark replied, it's a bad practice to use GlideRecord() or reference() in client script because of performance. It's better to use GlideAjax to call Script Include function asynchronously.

It's not recommended to use GlideAjax in onSubmit() scripts because the script will continue execution and submit the form before returning a value. In this case, it's better to redesign to check a field in onChange() or fill other variable in a business rule.

Instead of dot-walking on client script, use g_scratchpad in display business rule or get the value in a GlideAjax call script include.

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Any follow-up needed? Or was my answer sufficient?
Let me know.

If your question is solved, please close the topic by marking my answer as correct. This will help others searching for a similar question and will remove the topic from the unsolved list.

Kind regards,
Mark
2020-2022 ServiceNow Community MVP
2020-2022 ServiceNow Developer MVP

---

LinkedIn
Community article, blog, video list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Any follow-up needed? Or was my answer sufficient?
Let me know.

If your question is solved, please close the topic by marking my answer as correct. This will help others searching for a similar question and will remove the topic from the unsolved list.

Kind regards,
Mark
2020-2022 ServiceNow Community MVP
2020-2022 ServiceNow Developer MVP

---

LinkedIn
Community article, blog, video list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn