Trying to call a REST object from a script got: Cannot find default value for object.

Nicol_
Giga Contributor

Hi,
I'm trying to call a REST message from a Scheduled script:


find_real_file.png

 

find_real_file.png

 

find_real_file.png

 

Executing the script I've got this error:
"Cannot find default value for object."

Any idea?
Many thanks!

1 ACCEPTED SOLUTION

Hi,

seems issue with the execute method

check docs link below

https://developer.servicenow.com/dev.do#!/reference/api/orlando/server/sn_ws-namespace/c_RESTRespons...

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

9 REPLIES 9

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Did you try check what error came in logs?

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Just saw the exception wrapped in the catch

find_real_file.png

 

Are there somewhere other usefull logs?

Hi,

I would recommend to test the rest message first and check what it expects?

Did you give the proper endpoint to that rest message GET method?

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

removing try catch got this:

org.mozilla.javascript.EcmaError: Cannot find default value for object.
Caused by error in <refname> at line 3

1: function printLog2() {
2: var r = sn_ws.RESTMessageV2('x_414554_nozomiapp.nozomi', 'get_assets');
==> 3: var response = r.execute();
4: gs.info('REST message');
5: }
6: printLog2();


I'm checking right now the REST message.