Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. If you already have a GE Object, you can call the GE Object's deleteRecord() method.

    Note

    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.

    Code Block
    languagejs
    titleDeleting an Existing GE Object
    linenumberstrue
    personGE.deleteRecord();

    You may optionally pass a callback to deleteRecord() to do post-deletion processing.

    Code Block
    languagejs
    titleDeleting an Existing GE Object
    linenumberstrue
    personGE.deleteRecord(function () {
    	// Do any post-deletion processing here
    });


  2. 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 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.

    Code Block
    languagejs
    titleDeleting Persons Record With ID 10
    linenumberstrue
    Aptify.framework.genericEntity.deleteRecord({
    	entityNameentity: "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.

    Code Block
    languagejs
    titleDeleting Persons Record With ID 10
    linenumberstrue
    Aptify.framework.genericEntity.deleteRecord({
    	entityNameentity: "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.
        }
    }); 

...