Satin AlBuy
1-855-856-7678
DestekSupport
Provides functionality for working with specific tables as a Table object instance.
This object contains the following members:
| Syntax | Returns | Description |
|---|---|---|
|
|
Returns the specified tableName as a Table object. |
Call the getTable method on the global tables object to get a Table object that represents a specific tableName.
The following script calls the getTable method to get the permissions table against which to execute queries.
function insert(item, user, request) { var permissionsTable = tables.getTable('permissions'); permissionsTable.where({ userId: user.userId, permission: 'submit order' }).read({ success: function(results) { if (results.length > 0) { // Permission record was found. Continue normal execution. request.execute(); } else { console.log('User %s attempted to submit an order without permissions.', user.userId); request.respond(statusCodes.FORBIDDEN, 'You do not have permission to submit orders.'); } } }); }