What does [object GlideRecord] mean when i am using gs.info to see the output ?

SK41
Giga Guru

Hi,

I have a  requirement where i have  to display message  based on the value(0-9) that user gives in a survey. There is out of   the box script include SPSurveyAPI which is used.           

find_real_file.png 

in line 683 getMessages(gr) what  value comes in (gr)? I used  gs.info()    it gives output as [object GlideRecord].

What  does this  output  mean?   

Also , how can i get  to display different msgs based on the ratin users give in survey?

Suppose,user rate us 4 which is a low value so i need to display a message and if user give say 8 which is high then a different msg to be displayed. These values that users give for surveys taken are stored in   asmt_assessment_instance_question table.                 

Please help me in this regard.

Thanks                           

7 REPLIES 7

when i am gliding inside table and printing any field's value it is giving me as undefined.Does this mean GlideREcording inside function to another table is not possible.

I am trying to modify SPSurveyAPI out of the box script include. 

function getMessages(gr) is inside this.

I want to modify these OOB messages and print them based on user rating.Is it possible to do so in this script include?

Gliderecord can be done anywhere.

var gr = new GlideRecord("table1");

gr.addQuery("codition");

gr.query();

if(gr.next()) {

gs.print(gr.your_field_name); //this will print value of the fields of table1.

}

If you want other table aslo, then do another gliderecord same with table2

yes i am doing. But, it should print value which is field in the gliderecorded table but i am getting undefined in the logs.(highlighted in blue).

function getMessages(gr) {
gs.info("gr is" +gr);
gs.info("Table name is "+gr.getTableName());
var instanceDueDate = gr.getDisplayValue('due_date');
var messagesMap = {};
var evaluationMethodDisplay = gr.getDisplayValue('metric_type.evaluation_method');
gs.info("evaluation" +evaluationMethodDisplay);
var title = surveyGR.getDisplayValue('metric_type') + '';
gs.info("metric"+gr.metric_type);
gs.info("title"+title);
var ar = new GlideRecord('asmt_assessment_instance_question');
gs.info("in table");

gs.info("value" +ar.value);
var c=ar.addEncodedQuery('metric.name=NPS');                            //getting       undefined in logs
gs.info("encoded query"+c);
var a= ar.addQuery('instance.number', gr.number);                              //getting undefined in logs
gs.info("instance"+a);
ar.query();
gs.info("in query");
if (ar.next()) {
var nps = ar.value;
gs.info("nps value"+nps);
}
gs.info("outside if");
if(nps>5)
{
messagesMap.submitted_msg = gs.getMessage('We really appreciate you taking the time to provide us with your feedback. Thank you!',evaluationMethodDisplay);
}

else{

messagesMap.submitted_msg = gs.getMessage('We  hope  to  get better. Thank you!',evaluationMethodDisplay);

}