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
Rakesh KumarRakesh Kumar 

Any Idea to display the territory list with subordinates list....

Hi All,


I would like to display the list of territory with all my subordates territory .





          ->MySubordinate01 Territory

          ->MySubordinate02 Territory

          ->MySubordinate03 Territory

          ->MySubordinate04 Territory


Is there any idea to fetch list in apex code and wanna use it on visualfroce page.


Thanks in advance





Try the below snippet as reference:


MyTerritory act like Account Object

MySubordinate01 Territory,MySubordinate02 Territory,MySubordinate03 Territory,MySubordinate04 Territory act like a contact present in the MyTerritory




public string acct{get;set;}

public string acc{get;set;}

public list<contact> con{get;set;}


public void getcontact()


  set<id> conId = new set<id>();

  for(Account a: [Select id from Account where name=:acct])


    for(Contact c : [Select From Contact c where c.AccountId =])

    conId.add( c.Id);


  con =[Select id,lastname from Contact where (Id in : conId)];




VF page

     <apex:inputText value="{!acct}" />


 <apex:outputText value="{!acc}" id="theValue"/><br/>

 <apex:repeat value="{!con}" var="CONN" id="theRepeat">

        <apex:outputText value="{!CONN}" id="theValue"/><br/>



Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.