No Longer needed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2024 06:35 PM - edited 03-15-2024 03:01 AM
No Longer needed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2024 08:30 PM
Hi @Kumaru
Do you want to populate 'question:answer' as a choice or just 'answer' as choice ? Can you please elaborate on your requirement ?
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2024 08:41 PM
Suppose I have a custom table 'u_question_and_answer' which stores all the Questions and the Answers.
Now If I want to get them as Key Value Pairs, I can make use of below script include :
var getChoices = Class.create();
getChoices.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getQuestionandAnswers:function(){
var qaArray = [];
var qaGR = new GlideRecord('u_question_and_answer');
qaGR.query();
while(qaGR.next()){
qaArray.push((qaGR.u_question+':'+qaGR.u_answer).toString());
}
return qaArray.toString();
},
type: 'getChoices'
});
When called, this Script Include will give Q and A in the form of Key:Value Pairs.
You can use this response in your client script to populate the choices.
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.