AppRecord Add() Method

(SBM On-Premise/PaaS only) Adds a new row to a table.

Function Signature

 int Add()

Parameters

Parameter Type Description

None

Return

Type Description

int

The TS_ID of the record added, which is unique to this table. Zero means the record could not be added due to an error.

Technical Details

SBM ModScript version: 11.3.

Example

var tableId = Ext.TableId("TS_CONTACTS");
var myRecord = Ext.CreateAppRecord(tableId);
var myRecord.SetFieldValue("CONTACTLASTNAME", "Smith");
var ret = myRecord.Add();
if (ret == 0){
  Ext.LogErrorMsg("Error adding Contact.");
}

Notes

After creating an AppRecord from the desired table and setting any desired field values, use this method to add the record as a new row in its table. This is not for use with Primary tables, because those items must go through a Submit transition. However, it is possible to make a copy of a Primary table item using this method.

Note: Changes to cached items written with the Add() method are not immediately available to other SBM servers that are connected to the same database. The other servers see these changes when the cache periodically synchronizes with the database. The time interval for cache updates can be configured and defaults to twenty seconds.

Related Topics

AppRecord