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

Kentaro Numata
Tera Guru

Hi 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?

Pooja Mallikarj
Kilo Sage

Hi,

As you said it is not recommended to use GlideRecord in Catalog UI policy instead of it you can use GlideAjax in client script or ui policy to call server side script include.

GlideAjax :

  • GlideAjax class allows the execution of server-side code from the client. GlideAjax calls pass parameters to the script includes, and, using naming conventions, allows the use of these parameters.

GlideRecord:

  • is used for database operations instead of writing SQL queries.
  • is an object that contains zero or more records from one table. Another way to say this is that a GlideRecord is an ordered list.

You can refer the below link which explains the difference between them.

https://community.servicenow.com/community?id=community_question&sys_id=5254c369dbd8dbc01dcaf3231f96...

Thanks,

Pooja M

Virendra Mali
Mega Expert

Hi,

you can use GlideRecord api on server side ie on business rule or script include and at client side you can use g_form api. You can use GlideAjax class in Client Script basically GlideAjax  can call a server side code ie script include  in client script.It is similar to JQuery's Ajax method.

The Workflow Engine is part of the Glide Script Engine and is invoked with the insert, update, delete or cancel of a Glide record. Because of this, each workflow can be configured to run based on conditions. This is similar to how Business Rules determine when to run.

you can use this link of various api used in client side and server side  

Client side api: https://developer.servicenow.com/dev.do#!/reference/api/newyork/client/c_GlideFormAPI

server side api:https://docs.servicenow.com/bundle/london-application-development/page/script/server-api/topic/p_Ser...

Workflow reference: https://hi.service-now.com/kb_view.do?sysparm_article=KB0538525#:~:text=The%20Workflow%20Engine%20is...

Please mark correct and helpful if my response helps you

Regards

Virendra

Sudhanshu Talw1
Tera Guru

Here what you require to understand that GlideRecord is a server side API which is used to perform database operation which is technically a backend work & it should not be written in front end UI policy or client script.

If you want to execute or fetch data use glideajax which fetches data via async calls. This way you can't perform GlideRecord operation on server side demanded via client script usi g glideajax . Script include should be written & called via glideajax API.

 https://docs.servicenow.com/bundle/orlando-application-development/page/script/ajax/topic/p_AJAX.htm...

Thanks

Sudhanshu