Accessing question choice fields from a multiple choice variable

kim-lindgren
Kilo Sage

A multiple choice variable request_type_action has two question choices. The question choices exist on the table question_choice. Starting from my request_type_action record, how do I access the 'text' field on the question_choice table?

 

I need to access it through a script in Flow Designer. I cannot dot-walk to the question choices, probably because they exist on a different table. 

1 ACCEPTED SOLUTION

Riya Verma
Kilo Sage
Kilo Sage

Hi @kim-lindgren ,

 

Hope you are doing great.

 

To access the 'text' field on the question_choice table from your request_type_action record, try using below reference code:

var requestTypeActionSysId = current.request_type_action.toString();
var questionChoiceGR = new GlideRecord('question_choice');
questionChoiceGR.addQuery('question', requestTypeActionSysId);
questionChoiceGR.query();
while (questionChoiceGR.next()) {
    var text = questionChoiceGR.text.toString();
    // Perform further operations with the 'text' value
}

 

Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma

View solution in original post

3 REPLIES 3

Riya Verma
Kilo Sage
Kilo Sage

Hi @kim-lindgren ,

 

Hope you are doing great.

 

To access the 'text' field on the question_choice table from your request_type_action record, try using below reference code:

var requestTypeActionSysId = current.request_type_action.toString();
var questionChoiceGR = new GlideRecord('question_choice');
questionChoiceGR.addQuery('question', requestTypeActionSysId);
questionChoiceGR.query();
while (questionChoiceGR.next()) {
    var text = questionChoiceGR.text.toString();
    // Perform further operations with the 'text' value
}

 

Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma

Thank you!

 

With a few modifications (the toString() method on line 1 didn't work but I imported the sysID statically instead), this worked perfectly.

Great @kim-lindgren , thank you for your inputs.

 

Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma