function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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);
    }
}