UI Builder - Dropdown Component - Item Script - GlideAjax - undefined

Renee-17
Tera Guru

In UI Builder, I added a dropdown component.  I would like to populate the items via script.  In the script, I'm attempting to make a GlideAjax call but GlideAjax is underscored in red and said to be undefined inside the script.  The Script Include getProductsLists is client callable.  Currently there are no roles associated with the script.  In viewing other posts, it appears that you should be able to use GlideAjax in UI Builder scripts.  Need help to understand if I can use GlideAjax and if so, I do I get it to work

 

function evaluateProperty({api, helpers}) {
          var ga = new GlideAjax('getProductsLists');
          ga.addParam('sysparm_name' , 'getUniqueStatus');
........
1 ACCEPTED SOLUTION

Maik Skoddow
Tera Patron
Tera Patron

Hi @Renee-17 

f you see GlideAjax is "undefined" and underlined in red in your UI Builder script, it's because GlideAjax is not available in the UI Builder scripting context. UI Builder scripts run in a modern browser-based JavaScript environment, not the legacy ServiceNow client scripting environment where GlideAjax is available. This is a common point of confusion for developers transitioning from classic UI scripts to UI Builder.

 

Find a working solution for your question at https://www.servicenow.com/community/developer-forum/call-script-include-from-ui-builder/m-p/2102346 

 

Maik

View solution in original post

2 REPLIES 2

Maik Skoddow
Tera Patron
Tera Patron

Hi @Renee-17 

f you see GlideAjax is "undefined" and underlined in red in your UI Builder script, it's because GlideAjax is not available in the UI Builder scripting context. UI Builder scripts run in a modern browser-based JavaScript environment, not the legacy ServiceNow client scripting environment where GlideAjax is available. This is a common point of confusion for developers transitioning from classic UI scripts to UI Builder.

 

Find a working solution for your question at https://www.servicenow.com/community/developer-forum/call-script-include-from-ui-builder/m-p/2102346 

 

Maik

Thanks for the info!