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: /
  • Once a RITM is submitted, we do see the variables with its values are stored in a table - sc_multi_row_question_answer
  • 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());
        *** 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 or Environment

London and above

Article Information

Last Updated:2019-08-26 06:54:24