Can I use Glide Record on Script of Catalog UI Policy?

Kentaro Numata
Tera Guru

Can I use Glide Record on Script of Catalog UI Policy?

I was instructed not to use Glide Record, but to use Glide Ajax on Catalog Client Script. (Unable to get table record)

I want to know the division of GlideRecord and GlideAjax.

1 ACCEPTED SOLUTION

Yes, Glide Ajax needs to be used in UI policy. Server side scripting is used in the workflow hence Glide Record should be used in Workflow.

Client Script, UI Policy, UI Script i.e. in any client side scripting Glide Ajax needs to be used.

Business Rule, Script Include, Workflow script i.e. in any server side script Glide Record needs to be used.

View solution in original post

8 REPLIES 8

Alok Das
Tera Guru

Hi Kentaro,

The Glide Record is a server side API and Glide Ajax is a client side API.  UI policy and Client script is a client side scripting and Glide Ajax is used. You can refer to the below link for more details:

https://snprotips.com/blog/2016/2/6/gliderecord-client-side-vs-server-side

Kindly mark my answer as Correct and Helful based on the impact.

Regards,

Alok

Hello Das,

Thank you for replying!

You mean, I should use GlideAjax on Script of Catalog UI Policy. Right?

And, Which one should I use on Script of WorkFlow?

Regards,

Kentaro.

Yes, Glide Ajax needs to be used in UI policy. Server side scripting is used in the workflow hence Glide Record should be used in Workflow.

Client Script, UI Policy, UI Script i.e. in any client side scripting Glide Ajax needs to be used.

Business Rule, Script Include, Workflow script i.e. in any server side script Glide Record needs to be used.

@Kentaro Numata 

Usually you don't include scripts in UI policy.

UI Policies are meant for simple task of showing/hiding fields; making them read-only or mandatory.

For complex logic you always use onChange client script on that variable/field

Also as per ServiceNow recommendation and best practices you should not use GlideRecord in any client side scripts.

You can use GlideAjax and combination of Script Include.

Workflow run script is server side so you cannot use GlideAjax there; GlideRecord is allowed

Below link should help you best practices

Client Scripting Technical Best Practices

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader