Aptify JavaScript API: GE Primer
Obtaining a GE Object
To get a GE object, you'll need the entity name and record ID of the record you're interested in. (If you want a new record, that's ID -1.) Call Aptify.framework.genericEntity.getEntityObject(); the GE will be passed to the callback function.
Obtaining a GE Object
Aptify.framework.genericEntity.getEntityObject("Persons", 10, function (result) { if (result.success) { var personGE = result.GE; } });
Fields on a GE Object
Fields on a GE object can be accessed in two ways: with get()/set() methods or simply by referring to the field as a property of the GE Object.
Field Access
// Getting a field value var name = personGE.FirstLast; var company = personGE.get("CompanyName"); // Setting a field value // (I'm not sure what happens if you try to set the value of a virtual field; // it may work on the client side, but it almost certainly won't actually save to the database.) personGE.LastName = "Test"; personGE.set("Department", "Testing");
Using the property access is generally advised because it's shorter and clearer. The advantage of using get() or set() is that you don't have to get the capitalization of the field name right; it's corrected for you.
Field Capitalization
var name = personGE.firstlast; // field capitalization is wrong, so name gets the value undefined var name = personGE.get("firstlast"); // field capitalization is wrong, but the get() method is smart enough // to find the field anyway and name is set correctly personGE.first = "Test"; // field capitalization is wrong; a new property on the object is created // with the value "Test", but the person's first name does not actually change personGE.set("first", "Test"); // field capitalization is wrong, but the set() method is smart enough to // find the field anyway and the person's first name changes to Test
Copyright © 2014-2017 Aptify - Confidential and Proprietary