Versions Compared

Key

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

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

Note

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.

...

  1. Via properties:

    Code Block
    languagejs
    titleField Access Via Properties
    linenumberstrue
    // Getting a field value
    var name = personGE.FirstLast;
     
    // Setting a field value
    
    personGE.LastName = "Test";
  2. Via accessor methods:

    Code Block
    languagejs
    titleField Access
    linenumberstrue
    // Getting a field value
    var company = personGE.get("CompanyName");
     
    // Setting a field value
    personGE.set("Department", "Testing");

...

Tip
titleGet 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.

Tip
titleGet 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.

Info
titleField 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.

Code Block
languagejs
titleField Capitalization
linenumberstrue
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

...