Object properties won't print
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2023 02:16 PM
Hi
I am trying to print properties of a user object in background script using the following:
var testUser = gs.getUser().getUserByID('test test 3');
gs.print(Object.getOwnPropertyNames(testUser));
and am getting the following error:
Evaluator: com.glide.script.RhinoEcmaError: Expected argument of type object, but instead had type object
script : Line(2) column(0)
1: var testUser = gs.getUser().getUserByID('test test 3');
==> 2: gs.print(Object.getOwnPropertyNames(testUser));
Not sure what I am doing wrong here?
Thanks
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2023 10:04 PM
Hi @Mike D1 ,
you're basically passing or using an object as a variable that doesn't exist. You need to define it and make sure it's instantiated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2023 10:27 AM
Thanks Sandeep. Is this not the object here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2023 12:47 PM
Hi Mike,
Please see:
for proper syntax and a working example.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2023 01:07 PM - edited 03-06-2023 01:09 PM
Thanks for the link Bert. I am specifically wanting to know why Object.getOwnPropertyNames won't return the properties of my object. Do you know if this is a limitation of the background script tool?