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