java.lang.SecurityException: Invalid object in scoped script: [object SNC] in scoped app

Mike Hashemi
Kilo Sage

I am writing a scripted REST API to create or update a CI based on some JSON. The API resource lives in a scoped app and calls a script include in the same scope. When I send in the data, the API returns:

 

{
    "http_status": "500",
    "status_message": "Internal ServiceNow error: JavaException: java.lang.SecurityException: Invalid object in scoped script: [object SNC]. The value of output is: undefined"
}

 

I tried using SNC in two ways:

 

var output = JSON.parse(SNC.IdentificationEngineScriptableApi.createOrUpdateCI('REST API Import', input));

 

And:

var output = JSON.parse(new global.SNC.IdentificationEngineScriptableApi.createOrUpdateCI('LogicMonitor CMDB REST API', input));

 

They both produce the same error. How can I use SNC or is there something else I should be using?

1 ACCEPTED SOLUTION

DrewW
Mega Sage
Mega Sage

I dislike scoped apps because of things like this.

 

Looks like there is a different object you need to be using

https://developer.servicenow.com/dev.do#!/reference/api/tokyo/server/sn_cmdb-namespace/Identificatio...

 

View solution in original post

1 REPLY 1

DrewW
Mega Sage
Mega Sage

I dislike scoped apps because of things like this.

 

Looks like there is a different object you need to be using

https://developer.servicenow.com/dev.do#!/reference/api/tokyo/server/sn_cmdb-namespace/Identificatio...