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 A GE Object

When you need to manipulate a record, you'll want to use the Aptify JavaScript API's version of a Generic Entity Object.

Step-by-step guide

  1. Know the Entity Name and Record ID of the record you're interested in.

    Creating a New Reocrd

    Just as in the Aptify .NET API, creating a GE Object with a Record ID of -1 and saving it will create a new record in the database.

  2. Call the Aptify.framework.genericEntity.getEntityObject() function, which passes an object containing the GE Object into its callback function.

    1. One way to call getEntityObject() is to pass each piece of data as a separate parameter:

      Obtaining a GE Object for Persons record with ID 10
      Aptify.framework.genericEntity.getEntityObject("Persons", 10, function (result) {
      	if (result.success) {
      		var personGE = result.GE;
      		// You can now use personGE
      	}
      });
    2. Alternately, you can pass each piece of data as a property of a single object parameter:

      Obtaining a GE Object for Persons record with ID 10
      Aptify.framework.genericEntity.getEntityObject({
      	entity: "Persons",
      	recordId: 10,
      	callBack: function (result) {
      		if (result.success) {
      			var personGE = result.GE;
      			// You can now use personGE
              }
          }
      });

 

Beware making synchronous assumptions!

Even though Aptify.framework.genericEntity.getEntityObject() is capable of synchronously returning a GE Object, you should never assume that it will do so. The best practice is to use the GE Object provided in the callback function, as shown above.

Synchronous Assumption
// The wrong way to do it:
 
var personGE = Aptify.framework.genericEntity.getEntityObject("Persons", 10);
// personGE may or may not be undefined at this point, 
//depending on whether getEntityObject() executed synchronously

 

Copyright © 2014-2017 Aptify - Confidential and Proprietary