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

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

When you have a GE Object and want the GE Object for one of its subtype records, you can get it if you know the name of the subtype.

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.

    // 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. This gives you access to the subtype, which has helpful methods to find the subtype record you are looking for.

    var personGESubTypes = personGE.subTypes;
    var personCompanySubType = personGESubTypes.findByName(subTypeName);

     

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

      var aPersonCompany = personCompanySubType.findRecordById(23);  
      // The personGE from the Get A GE Object example does not actually have PersonCompany records, 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:

      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:

    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

There are no items with the selected labels at this time.

  • No labels