Thank you for your feedback.
Form temporarily unavailable. Please try again or contact to submit your comments.
  • Madrid
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store

Client script usage examples

Log in to subscribe to topics and get notified when content changes.

Client script usage examples

Use the following as examples for how to use client scripts in Service Portal.


The g_list global helps you set the filter of a glide list element or a list collector variable. Use this API in place of the g_filter API on desktop client scripts.
function onLoad() {
  var myListCollector = g_list.get("my_list_collector");
  myListCollector.addItem('3a700d39af5f4fc0aab978df90f4c692', 'Power Supply');
  myListCollector.addItem('1cb93419a3a248318da8f814140b42f6', 'Backpack');


The g_service_catalog global is only available in Service Portal service catalog item scripts. Use this API to know if your catalog item script is being run as part of an order guide or on its own.
 function onLoad() {
   if (window) // if CMS don't run this

    // g_service_catalog api for Service Portal and Mobile
    var isOrderGuide = g_service_catalog.isOrderGuide();
    g_form.setValue("is_order_guide", isOrderGuide ? "Yes!" : "Nope :(");