Delete a Subtype Record
When you want to delete one (or all) of the subtype records of a GE Object, you can call the appropriate remove() method on the subtype.
This How-To 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.
Â
To delete all subtype records from a particular subtype, simply get the subtype from the GE Object and call removeAll().
Delete All Records of a Subtype// Remove all Company associations from our Person // by deleting all PersonCompanies subtype records from the Person's GE. var personCompanySubType = personGE.subTypes.findByName("PersonCompanies"); personCompanySubType.removeAll();
To delete a single subtype record for which you know the position in the subtype array, call removeAt().
Delete One Record By Array Index// Remove the first Company association from our Person // by deleting the first PersonCompanies subtype record from the Person's GE. var personCompanySubType = personGE.subTypes.findByName("PersonCompanies"); if (personCompanySubType.records.length > 0) { personCompanySubType.removeAt(0); }
To delete a single subtype record for which you know the record ID, call removeById().
Delete One Record By Array Index// Remove a Company association from our Person // by deleting a PersonCompanies subtype record from the Person's GE. var personCompanySubType = personGE.subTypes.findByName("PersonCompanies"); if (personCompanySubType.records.length > 0) { personCompanySubType.removeById(0); // removeById does nothing if no matching ID is found }
To delete a single subtype record for which you have a GE Object, call remove().
Delete One Record By Array Index// Remove a Company association from our Person // by deleting a PersonCompanies subtype record from the Person's GE. var personCompanySubType = personGE.subTypes.findByName("PersonCompanies"); if (personCompanySubType.records.length > 0) { var personCompanyGE = personCompanySubType.records[0]; // Now that we have the GE, we can delete it from the subtype personCompanySubType.remove(personCompanyGE); }
Â
Related articles
Copyright © 2014-2019 Aptify - Confidential and Proprietary