Object properties won't print

Mike D1
Giga Guru

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

6 REPLIES 6

Community Alums
Not applicable

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.

 

Thanks Sandeep. Is this not the object here?

MikeD1_0-1678127219637.png

 

Bert_c1
Kilo Patron

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?