Versions Compared

Key

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

...

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.

Step-by-step guide for getting a single subtype GE Object

 

  1. Know the Name of the subtype Entity.

    Code Block
    languagejs
    linenumberstrue
    // In this example, we'll get information about a Company related to our person, so we want the PersonCompanies subtype.
    var subTypeName = "PersonCompanies";
  2. Access the subtypes of your GE , and find the one you want by name, and get the subtype records. This gives you access to the subtype, which has helpful methods to find the subtype record you are looking for.

    Code Block
    languagejs
    linenumberstrue
    var personGESubTypes = personGE.subTypes;
    var personCompanySubType = personGESubTypes.findByName(subTypeName);
    var personCompanyRecords

     

    1. If you know the subtype record's ID, you can use the findRecordById() function:

      Code Block
      languagejs
      linenumberstrue
      var aPersonCompany = personCompanySubType.
    records
    1. findRecordById(23);  
      // The personGE from the Get A GE Object example does not actually have PersonCompany records
    is an array of GE Objects that you can index into or loop through
    1. , so aPersonCompany will be undefined
    2. If you want to search by some other field, you can use find(), which takes a field name and a field value:

      Code Block
      languagejs
      linenumberstrue
      var aPersonCompany = personCompanySubType.find("Title", "CEO");
      // The personGE from the Get A GE Object example does not actually have PersonCompany records, so aPersonCompany will be undefined

Step-by-step guide for getting all subtype record GEs

  1. If you want to loop through subtype records, you have access to an array of the subtype GEs from a property with the name of the subtype Entity:

    Code Block
    languagejs
    linenumberstrue
    var personCompanyGEs = personGE.PersonCompanies;
     
    console.log("There are " + personCompanyGEs.length + " PersonCompanies records on this Person.");
     
    for (var index = 0; index < personCompanyGEs.length; index++) {
    	console.log("Title is " + personCompanyGE[index].Title + " at " + personCompanyGE[index].CompanyID_Name);
    }

 

 

Filter by label (Content by label)
showLabelsfalse
max5
spacesRD
sortmodified
showSpacefalse
reversetrue
typepage
labelsgeneric-entity subtype subtypes aptify-javascript-api nonvisual-javascript-api