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 .

 

like

 

    ->MyTerritory

          ->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

Rakesh

 

Navatar_DbSupNavatar_DbSup

Hi,


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

 

Controller

 

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 c.id From Contact c where c.AccountId = :a.id])

    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/>

    </apex:repeat>

 

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