Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
Service catalog - How to access Multi-row variable set - Support and Troubleshooting
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • Service catalog - How to access Multi-row variable set
KB0743684

Service catalog - How to access Multi-row variable set


54502 Views Last updated : Mar 11, 2025 public Copy Permalink English (Original)
  • English (Original)
  • Japanese
KB Summary by Now Assist

Issue

This is an example of how to access a Multi-row variable set from a script.

  • Here is a list of Multi-Row Variable sets: /nav_to.do?uri=%2Fitem_option_new_set_list.do
  • Once a RITM is submitted, we do see the variables with its values are stored in a table - sc_multi_row_question_answer
    • See Scriptable service catalog variables for more info
  • In the docs, table_var means we should provide the name of the Multi-Row variable's which is Internal Name
  • The following sample script can be used to access the variables:
    • We have a multi-row variable with the name "server_build_list" and defined with the following fields [with data type]:
      • u_data_center  - Reference
      • u_how_many - Integer
      • u_storage_size - reference
    • Script to access the data:
      • var gr = new GlideRecord('sc_req_item');
        if (gr.get('<SYS_ID OF RITM>'))
        {
        // Syntax for this is gr.variables.table_var which returns JSON array value as String
        gs.log( "1.variables "+ gr.variables.server_build_list);
        }

        // Syntax for this is gr.variables.table_var.getRow(<ROW NUMBER [i]>) which returns ith row from the multi row variable
        // and we are trying to access a cell out of it as below

        var row = gr.variables.server_build_list.getRow('1');
        gs.log( "Fetching Row 1 "+ row.u_data_center);

        // Syntax for this is gr.variables.table_var.getRowCount( ) which returns current row count
        gs.log( "Row Count "+gr.variables.server_build_list.getRowCount());
        Result
        *** Script: 1.variables [ { 
        "u_data_center" : "a41d652bdb335b00af053b2ffe9619e0", 
        "u_how_many" : "1",  
        "u_storage_size" : "1024" 
        }, { 
        "u_data_center" : "a41d652bdb335b00af053b2ffe9619e0", 
        "u_how_many" : "4", 
        "u_storage_size" : "2048" 
        } ] 

        *** Script: Fetching Row 1 a41d652bdb335b00af053b2ffe9619e0
        *** Script: Row Count 2 

 

Release

London and above


The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.