AppRecord Update() Method

(SBM On-Premise/PaaS only) This method updates the item in the database using the values from the item.

Function Signature

 bool Update()

Parameters

Parameter Type Description

None

Return

Type Description

bool

Returns true if the record is updated in the database.

Technical Details

SBM ModScript version: 11.3.

Example

// Create a Contact record
var tableId = Ext.TableId("TS_CONTACTS");
var myRecord = Ext.CreateAppRecord(tableId);
var whereClause = "TS_CONTACTFIRSTNAME = 'Joe'";
if( myRecord.ReadWithWhere(whereClause) ) {
	// Get a lock, set the value, update and unlock
	var locked = myRecord.Lock();
	myRecord.SetFieldValue("CONTACTLASTNAME", "Smith");
	myRecord.Update();
	var unlocked = myRecord.Unlock();
}

Notes

The values of all fields in the calling AppRecord are written to the database. Any fields that the current user has privileges to update may be modified and the Update method commits them to the database. This method modifies an existing record, based on the TS_ID of the calling AppRecord. To add a new record, see the Add() method.

For VarRecords, this method replicates the functionality of the system Update transition.

Note: During Post-Transition, Post-State, and Pre-State scripts, it is not necessary to call Shell.Item().Update() because the system always calls Update after the script finishes. However, if you create any other AppRecord objects, you will need to call Update on those each of those objects; the system always calls Update only for Shell.Item().

Changes to cached items written with this 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

AppRecord UpdateWithLock() Method