dot walking returns undefined
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2018 07:28 AM
Hello,
I am trying to retrieve information from a reference field but am getting "undefined"
I have tried the below so far
gs.info("!>>> country" + gr.cmn_location.u_countries.getValue('u_country'));
gs.info("!>>> country" + gr.cmn_location.u_country_cd_iso2.getValue('u_country'));
gs.info("!>>> country" + gr.Location.u_country_cd_iso2.Counry.toString);
The field in form manager looks like this
Other field on the GR return fine?
How do I retrieve information contained in reference fields?
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2018 07:32 AM
Hi Salzo,
getValue and SetValue dont work with Dot Walking
In your code to the values, dot walk further
gs.info("!>>> country" + gr.cmn_location.u_countries.u_country);
gs.info("!>>> country" + gr.cmn_location.u_country_cd_iso2.u_country);
gs.info("!>>> country" + gr.Location.u_country_cd_iso2.Counry.toString);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2018 07:35 AM
getValue() method should work. But I see you are using cmn_location as the field name which is a table name instead. Can you post the entire code and let me know what you are trying to achieve.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2018 07:38 AM
You can use getValue but if you've dot-walked a bit you need to just put it on the end as below: (also note toString() is a method and so needs the brackets)
gs.info("!>>> country" + gr.cmn_location.u_countries.u_country.getValue());
gs.info("!>>> country" + gr.cmn_location.u_country_cd_iso2.u_country.getValue());
gs.info("!>>> country" + gr.Location.u_country_cd_iso2.Counry.toString());

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2018 07:53 AM
Please take a look at this post to see why using a getValue wont work.
You can either do something like
gs.info("!>>> country" + gr.cmn_location.u_countries..getRefRecord().getValue('u_country'));
Or
gs.info("!>>> country" + gr.cmn_location.u_countries.u_country.getDisplayValue());