Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Widget Data Object Not Displaying Results

Ashley
Mega Sage

Good Evening,

 

I have a really odd problem, assigning some text to a data object but it won't display correctly on the html template.

Server Side:

 

var config = new GlideRecord(gs.getProperty('table'));
config.addQuery('number', 'LIKE', data.parent_configuration);
config.query();
if(config.next()) {
	data.desc2 = config.description;	
}

 

 Html:

 

 <div ng-if="data.show_desc == 'true'">{{data.desc2}}</div>

 

Result:

Ashley_0-1666896804523.png

Result is an empty Object but when I check the logs, I can see its being picked up correctly:

Ashley_1-1666896878350.png

Not sure what I am doing wrong... sigh

Any Ideas?

Kind Regards

Ashley

1 ACCEPTED SOLUTION

Ashley
Mega Sage

Good Afternoon,

Thank you all for the replies, I managed to resolve it, a few hours lost and all I needed to do was add .toString() on the end.... doh

 

End Result:

data.desc2 = config2.description.toString();

Kind Regards

 

Ashley

View solution in original post

5 REPLIES 5

Ashley
Mega Sage

Good Afternoon,

Thank you all for the replies, I managed to resolve it, a few hours lost and all I needed to do was add .toString() on the end.... doh

 

End Result:

data.desc2 = config2.description.toString();

Kind Regards

 

Ashley