+ Start a Discussion
sahitya adminsahitya admin 

Convert for (Schema.ChildRelationship ) into String

Hi ,

how to Convert Schema.ChildRelationship into String,I tried with TypeCasting  and toString(),but are are working.need help,thanks in advance.
Satish PrajapatSatish Prajapat

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);
    }
}