Defects
SBM: Delete() method from AppScript and ModScript delete rows from TS_USERS table.
ID: | D28162 | |
Published: | 26 July 2024 | |
Updated: | 27 August 2024 |
Defect Id
DEF349436
Originally Reported Against
SBM 12.1
Also Affects
SBM 12.1 Hotfix 1
SBM 12.1 Hotfix 2
SBM 12.1 Hotfix 3
SBM 12.1 Hotfix 4
SBM 12.1 Hotfix 5
SBM 12.1 HotFix 6
SBM 12.1 Hotfix 2
SBM 12.1 Hotfix 3
SBM 12.1 Hotfix 4
SBM 12.1 Hotfix 5
SBM 12.1 HotFix 6
Status
Submitted
Description
When trying to delete a user from AppScript or ModScript, the Delete() method will delete rows from the TS_USERS table. The records should be flagged as deleted, but not actually deleted.
Resolution
Workaround:
To flag a record as deleted, the STATUS field needs to be set to "1". So, instead of using the .Delete() method, use something such as this:
def deleteUser {
var userRec = Ext.CreateAppRecord( Ext.TableId("TS_USERS"));
userRec.ReadWithWhere( "TS_ID = ?", [Pair(DBTypeConstants.INTEGER,userID)]);
var locked = userRec.Lock();
userRec.SetFieldValue("STATUS",1);
userRec.Update();
var unlock = userRec.Unlock();
userRec.ReadWithWhere( "TS_ID = ?", [Pair(DBTypeConstants.INTEGER,userID)]);
var locked = userRec.Lock();
userRec.SetFieldValue("STATUS",1);
userRec.Update();
var unlock = userRec.Unlock();
}