JS Data
Data is the driving force behind your app. Integrate your custom JavaScript code with the web services in your app using these functions.
Last updated
Data is the driving force behind your app. Integrate your custom JavaScript code with the web services in your app using these functions.
Last updated
Get all records of a webservice by specifying the name and (when required) parameters of a webservice block to fetch the records for. Optionally the records for the current webservice (that is, the closest one to the current block) can be fetched by not specifiying any name. For example, to fetch all records of an Excel block that is the parent of the block running your code you simply call getRecords()
.
Name | Type | Required | Default |
---|---|---|---|
Example if using a data block with products in it. You can simply use your favorite JavaScript framework.
Here is a list of errors that can be thrown when calling this function in addition to generic errors:
Get the record that is currently selected. For instance, if your code is running in a block that is the child of a list block (e.g. an Excel block) getCurrentRecord()
will return the data item of the list item that the user selected in the previous screen.
Example if using the data showing a "detail" page.
Here is a list of errors that can be thrown when calling this function in addition to generic errors:
Error Code | Description |
---|---|
Error Code | Description |
---|---|
variableName
String
-
parameters
String
-
INVALID_ARGUMENT
The specified variableName
doesn't reference a webservice block.
An parameter in parameters
is not valid for the webservice.
WEBSERVICE_ERROR
The remote server returned an invalid result or the result could not be parsed.
MISSING_CONTEXT
The variableName
parameter is missing and the current block is not in a data context.
MISSING_CONTEXT
The current block is not in a data context.