I would like to know how to get the label question

Kotaro Kobayas1
Tera Contributor

When I tried to get the sc_req_item record question in the variable "sortedKeys" using the script below, I couldn't get the question of type Label.
Is there a way to get all questions including label questions?

1 REPLY 1

Ratnakar7
Mega Sage
Mega Sage

Hi @Kotaro Kobayas1 ,

 

If you're looking for information related to variables associated with a sc_req_item, you can iterate through the variables on the sc_req_item to retrieve information about them. Here's a general script to get started:

var requestItem = current.sysapproval.ref_sc_req_item;
var variables = new GlideRecord('sc_item_option');
variables.addQuery('request_item', requestItem);
variables.query();

while (variables.next()) {
    // Access information about the variable
    var variableName = variables.variable.name;
    var questionText = variables.variable.question_text;

    // Use the information as needed
    gs.info('Variable Name: ' + variableName);
    gs.info('Question Text: ' + questionText);
}

 

In this script, sc_item_option is used to retrieve the variables associated with a sc_req_item. Please note that the table names and field names might differ based on your instance's configuration, so you might need to adapt the script accordingly.

If you still can't get the information you need, consider checking the variable set associated with the sc_req_item. You can use sc_item_option and sc_item_option_mtom tables to traverse the relationships between variable sets and variables.

 

Thanks,

Ratnakar