Docs‎ > ‎Quick Reference‎ > ‎


SysUtility is a JavaScript object that offers access to several useful services.


SysUtility.getResource(resourceName, settings)

This will retrieve the value of the specified resource, using the settings in the second parameter, which must be an object that may have the following properties:
  • filter, sysfilter, userfilter: An object with the desired filter(s) for each resource. Use aliased (not table) attribute names for filter and sort.
  • order, sysorder, userorder: An object with the desired sorting order(s) for each resource.
  • pagesize: The maximum number of row per resource level.
  • offset: How many records to skip from the top resource.
  • chunksize: Determines how many rows to include in a single SQL query for a sub-resource batch.
Note: If you have disallowed free-form filters, only the sysfilter, userfilter, sysorder, and userorder properties work with SysUtility calls. For more information about disallowing free-form filters, see Manage your API Project.

The return value of getResource is an object array - the JSON object returned by the call. A typical example:
var parts = SysUtility.getResource("Products", {sysfilter: "less(price:100)", sysorder: "(price:desc)"});
for(var i = 0 ; i < parts.length ; i++){

You can also pass an array of string to sysfilter or sysorder:
sysfilter: ["less(...)", equal(...),"greater(...)"]

You can use '.' dot notation to reference a sub-resource(s) where the price of the product is less than 100 is a sub-resource or Customer.Orders.Product:
'sysfilter.Customer.Orders.Product': 'less(price:100)'

If the resource is a view, qualify it and the filter(s), for example:

var parts = SysUtility.getResource("nw:Customer Orders", {filter: {"nw:Customer Orders": "price < 100"}});

If the resource you are invoking is a stored procedure resource, then you can pass parameters as follows:

var orders = SysUtility.getResource("nw:MyProc", {procArgs: {empName: "Doe", amount: 123.45}});

rest<verb> - Get, Put, Post, Delete

You can also invoke other RESTful services from business logic or row events.
In these calls (restGet, restPut, restPost, restDelete, described below), you pass the following parameters:

params: an object containing the parameters to the call. 

For example:

var params = {
    name: "Acme",
    country: "Elbonia"
var json = SysUtility.restGet('', params);
var resultObject = JSON.parse(json);

This is equivalent to adding these parameters to the URL, e.g.:

You should generally avoid putting parameters directly in the URL because they need to be properly encoded -- it is much easier to pass them in as an object.

settings: an object containing the various settings for the call. The header setting is supported:

   {name: 'Acme', country: 'Elbonia'},
   {headers: {
      "Authorization" : "Basic base64string",
      "Cache-Control" : "no-cache"

requestData is a JavaScript object. It is converted to JSON before being sent. These methods do not support sending non-JSON data.
  • SysUtility.restGet(url, params, settings)
returns a stringified version of the result of the GET to the specified url.
var result = SysUtility.restGet(url, params, settings),
var myJson = JSON.parse(result);
  • SysUtility.restPut(url, params, settings, requestData)
returns a stringified version of the response of a PUT to the specified url using the requestData
    var result = SysUtility.restPut(url, params, settings, requestData),
    var myJson = JSON.parse(result);

  • SysUtility.restPost(url, params, settings, requestData)
returns a stringified version of the response of a POST to the specified url using the requestData
var result = SysUtility.restPost(url, params, settings, requestData),
var myJson = JSON.parse(result);

  • SysUtility.restDelete(url, params, settings)
returns a stringified version of the response of a DELETE to the specified url.
var result = SysUtility.restDelete(url, params, settings),
var myJson = JSON.parse(result);

For more info on HTTP headers, see Wikipedia Entry to for HTTP Headers

Error Handling

You can test the results of the response as shown below:

Which generates a log like this: