Forum Replies Created

Viewing 1 - 2 of 2 posts
  • Extentia

    Member
    November 30, 2016 at 7:24 am

    Hi Mohit,

    One liner answer to this question can be by using below line we can get object name based on parent id :
    List<Schema.ChildRelationship> lstCR = <parentID>.getSObjectType().getDescribe().getChildRelationships() ;

    Below is the detailed example to get child object names (list of string) by parent ID :

    ID idToGet = '<Any Parent Object ID>';
    List<string> lstChildObj = GetChildObjects(idToGet);
    System.debug(lstChildObj);

    // Below function accepts 18 digit parent ID and returns list of Child Object 's API name.
    public List<String> GetChildObjects(ID parentID)
    {
    List<string> lstChildObjects = new List<string>();
    Schema.DescribeSObjectResult parentDescribeResult = r
    String sObjName = parentDescribeResult.getName();
    System.Debug('Parent object name : ' + sObjName);
    for (Schema.ChildRelationship childRel: parentDescribeResult.getChildRelationships())
    {
    lstChildObjects.add(childRel.getChildSObject().getDescribe().getName());
    }
    return lstChildObjects;
    }

    Thanks,

    Extentia

  • Extentia

    Member
    November 30, 2016 at 6:56 am

    Salesforce Lightning Design System (LDS) and Bootstrap are both UI frameworks but are used for different purposes. With the Lightning Design System, you can build custom applications with a look and feel that is consistent with the core features of Salesforce; whereas Bootstrap can be used to develop attractive/custom branded UI and includes its own JavaScript framework. LDS is a pure CSS framework.

Viewing 1 - 2 of 2 posts

Popular Salesforce Blogs

Popular Salesforce Videos