- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2016 05:10 AM
I am in the process of converting a global scheduled job script into a custom scoped application. The job should fetch some data from an external service, fill the application scope local table with data.
Inserting records into global tables from a global scheduled script works well with following script:
var srv = new GlideRecord("cmdb_ci_server");
srv.get("correlation_id", hKey);
srv.correlation_id = hKey;
srv.host_name = "testhost";
srv.updateWithReferences();
When I try to run this script within a custom application on a custom application table I am not able to insert anything.
What am i doing wrong?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2016 03:27 AM
Ok finally i got it working. The problem was that i was not using the newer 'scoped scripted API' that can be found here:
then this script actually works for me without problems:
var srv = new GlideRecord('cmdb_ci_server');
srv.initialize();
srv.setValue('host_name', 'testhost');
srv.insert();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2016 05:27 AM
Hi Wolfgang,
updateWithReferences() function is not available for scoped apps. use update() for simple direct updates, Else you need to query related tables and do explicit update.
var srv = new GlideRecord("cmdb_ci_server");
srv.get("correlation_id", hKey);
srv.correlation_id = hKey;
srv.host_name = "testhost";
srv.update();
Thanks
Srinivas
Make this answer as helpful/correct if it does so
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2016 05:56 AM
var srv = new GlideRecord("cmdb_ci_server");
srv.get("correlation_id", hKey);
srv.host_name = "testhost";
srv.update();
Try that.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2016 12:12 PM
Hey Wolfgang,
The below thread should answer your question.
error Function updateWithReferences is not allowed in scope
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2016 11:22 PM
No does not work still, even if i use the update() method.
It does not work on the apps own scope tables as well as it does not work on global scope tables.
What am i doing wrong? Outside a custom app this scheduled job works, inside an app nothing