Delete A GE Object
When you want to delete a record, there are two possible ways to go about it.
Step-by-step guide
If you already have a GE Object, you can call the GE Object's deleteRecord() method.
This code assumes you have already gone through the steps in Get A GE Object and are coding inside of a callback to Aptify.framework.genericEntity.getEntityObject(). It continues that example, assuming you have already defined personGE.
Deleting an Existing GE ObjectpersonGE.deleteRecord();
You may optionally pass a callback to deleteRecord() to do post-deletion processing.
Deleting an Existing GE ObjectpersonGE.deleteRecord(function () { // Do any post-deletion processing here });
However, it's unlikely you loaded a record as a GE Object just to delete it. In that case, you simply need to know the Entity name and Record ID of the record you want to delete. You can then call Aptify.framework.genericEntity.deleteRecord() on it. Aptify.framework.genericEntity.deleteRecord() takes a single object parameter, so all data is provided to the function as properties of that object.
Deleting Persons Record With ID 10Aptify.framework.genericEntity.deleteRecord({ entity: "Persons", recordId: 10 });
You may optional supply either or both of two callbacks, one that is called when the record has been queued for deletion and one that is called once the record has been successfully removed from the database.
Deleting Persons Record With ID 10Aptify.framework.genericEntity.deleteRecord({ entity: "Persons", recordId: 10, afterDeleteQueuedCallback: function (result) { // Do any post-record-added-to-deletion-queue processing here. // At this point the record data has been removed from the client's // cache, but the record remains in the database. }, afterDeleteCallback: function (result) { // Do any post-deletion processing here. // At this point the record has been successfully deleted from the database. } });
Related articles
Copyright © 2014-2019 Aptify - Confidential and Proprietary