If you have a comment on this topic, contact Aptify Documentation. If you want to return to the Aptify Community Site, please click here.

Get or Set GE Fields

Once you have a GE Object, the most common thing you'll want to do with it is access its fields.

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.

Step-by-step guide

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.

  1. Via properties:

    Field Access Via Properties
    // Getting a field value
    var name = personGE.FirstLast;
    // Setting a field value
    personGE.LastName = "Test";
  2. Via accessor methods:

    Field Access
    // Getting a field value
    var company = personGE.get("CompanyName");
    // Setting a field value
    personGE.set("Department", "Testing");

Get or Set Embedded Field Values

You can get and set the value of an embedded field in exactly the same way as any other field.

Get or Set Virtual Fields

You can get the value of a virtual field in exactly the same way as any other field. You can also set it in the same ways, but unless the virtual field is one that has been linked to a field on an embedded object, the value you set will of course not propagate to the database when the GE Object is saved.

Field Capitalization

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, called "first",
// 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