Skip to main content
sahitya admin が「#Apex」で質問
Hi ,

how to Convert Schema.ChildRelationship into String,I tried with TypeCasting  and toString(),but are are working.need help,thanks in advance.
1 件の回答
  1. 2017年4月12日 12:48

    Hi Sahitya,

    The code written below will help you to write code, and there is no need to use toString()

    method for type casting. We can directly use as per requirement which is I shown in the program.

    public class Schema_childRelationship

    {

    String str;

    public void m1()

    {

    Schema.DescribeSObjectResult DescribeResultObject = Account.SObjectType.getDescribe();

    List<Schema.ChildRelationship> ListOFChildInfo =DescribeResultObject.getChildRelationships();

    for(Schema.ChildRelationship TempObj : ListOFChildInfo)

    {

    System.debug('Relationshipname:'+TempObj.getrelationshipname());

    str=str+TempObj.getrelationshipname();

    }

    System.debug('str = '+str);

    }

    }

0/9000