- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2019 12:30 PM
I'm working with GlideRecord in a Script include. (Server side) The query is working correctly, and returning the expected number of results.
However, I need to get some properties of reference values. i.e. I need to dot-walk.
For example:
var rec = new GlideRecord("apm_app_indicator_score");
rec.query();
var obj;
while (rec.next()) {
obj = {
score: rec.indicator_score,
score2: rec.getValue("indicator_score"),
type: rec.apm_application_profile_indicator.apm_metric.x_acce8_workfit_workfit_heat_type,
type2: rec.getValue("apm_application_profile_indicator.apm_metric.x_acce8_workfit_workfit_heat_type")
};
gs.info(JSON.stringify(obj));
}
The code above logs: { "score":{}, "score2":"3", "type":{}, "type2":null }
It appears you need to use getValue() to get properties, but you cannot use it to dot walk.
Is there a way to get child properties or do you have retrieve them with new GlideRecord queries? I understand you cannot dot walk results client side -- but this is server side. Is there a different way to do this?
Thanks
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2019 01:00 PM
Can you try:
type: rec.apm_application_profile_indicator.apm_metric.x_acce8_workfit_workfit_heat_type + "",

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 01:55 PM
Thank's Justin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2024 08:23 AM
Hey, Dave. What @Justin Lee2 said is essentially what happens. If you don't specifically convert to a string through type coercion such as (value + "") or toString(), you will get an object.