+ Start a Discussion
MnZ321MnZ321 

Add a picklist from a Set <ID>

I'm unable to add a picklist of territories in visualforce page and render table. How do I proceed? Please refer any materials if possibles. Following is my code..
 
public class TrackingPartners{

    public List<Torders__c> orders {get; set;}
    public TrackingPartners() {   
    }
    
    
    public list<Torders__c> getstart() {

    Map<Id,UserTerritory> UserTerritoryCurrentUserMap = new  Map<Id,UserTerritory>([Select u.UserId, u.TerritoryId, u.IsActive, u.Id  From UserTerritory u Where 

u.isActive=true and u.userId =: UserInfo.getUserId()]);
    system.debug('-----UserTerritoryCurrentUserMap SIZE-------'+UserTerritoryCurrentUserMap.size());
    
    
    set<Id> TerritoryIdSet = new set<Id>();
    for(UserTerritory ut:UserTerritoryCurrentUserMap.values())
    {
          TerritoryIdSet.add(ut.TerritoryId);
    }    
    
    List<Territory> childTerritories = [Select Id from Territory where ParentTerritoryID in :TerritoryIdSet];
    
    for(Territory ct : childTerritories) {
            TerritoryIdSet.add(ct.Id);
        }
    
    

    list<Group> map_group = [Select Id, RelatedId from Group where (Type='Territory' OR Type='TerritoryAndSubordinates') AND RelatedId IN : TerritoryIdSet];
    system.debug('-----map_group -------'+map_group);
   




    List<SUBSCR_SYSTEMS__c> lst_PartnersAcc = [SELECT LEGACY_CUST_NUM__c,Account__c
                                                 FROM SUBSCR_SYSTEMS__c WHERE Account__c IN                                                  
                                                 (Select  AccountId from AccountShare where ( UserOrGroupId IN : map_group OR  UserOrGroupId =:UserInfo.getUserId()) 

AND RowCause IN ('Territory', 'TerritoryManual', 'TerritoryRule'))
                                                 ];
                                               
    
                                                
                                                 
    Set<String>tempList = new Set<String>();

    for(SUBSCR_SYSTEMS__c s : lst_PartnersAcc) {
        tempList.add(s.LEGACY_CUST_NUM__c);

        
    }
    
    system.debug('-----tempList-------'+tempList);

    
    List<Torders__c> orders =[SELECT Torders__c,id, 

customer_order_number__c,name,order_no__c,account__c,account__r.name,number_of_line_items__c,number_of_items_open__c,lines_items_shipped__c,number_of_items_delivered__

c,order_date__c,Bill_to__c,Payer__c,Ship_To__c,Sold_to__c FROM Torders__c   
                                 WHERE  Bill_to__c IN: tempList OR
                                        Payer__c IN: tempList OR 
                                        Ship_To__c IN: tempList OR
                                        Sold_to__c IN: tempList
                                     ]; 
                                     system.debug('-----orders-------'+orders);

     return orders;                                
  }                                
  
}

and the VF ...
<apex:page Controller="TrackingPartners" >
<apex:stylesheet value="{!URLFOR($Resource.jQueryDataTablesZip, 'jQueryDataTablesZip/css/jquery.dataTables.css')}"/>

 <apex:pageBlock >
         <apex:pageBlockTable value="{!start}" var="o" styleClass="dataTable">
                <apex:column >
                        <apex:facet name="header">Order No.</apex:facet>                        
                 <a href="Class?id={!o.id}" onMouseOver="setTimeout(function(){awin=window.open('OrderLines?id={!o.id}','Order Lines','height=300, 

width=1000, left=400, scrollbars=yes');},1000);" onmouseout="awin.close();">{!o.Torders__c}</a>
           
                </apex:column>
                <apex:column >
                        <apex:facet name="header">Account</apex:facet>
                        <apex:outputText value="{!o.account__r.name}"/>
                </apex:column>                
                <apex:column >
                        <apex:facet name="header">Partner No.</apex:facet>
                        <apex:outputText value="{!o.Ship_To__c}"/>
                </apex:column>
                <apex:column >
                        <apex:facet name="header">Customer PO</apex:facet>
                        <apex:outputText value="{!o.customer_order_number__c}"/>
                </apex:column>
                <apex:column >
                        <apex:facet name="header">Open</apex:facet>
                        <apex:outputText value="{!o.number_of_items_open__c}"/>
                </apex:column>
                <apex:column >
                        <apex:facet name="header">Shipped</apex:facet>
                        <apex:outputText value="{!o.lines_items_shipped__c}"/>
                </apex:column>
                <apex:column >
                        <apex:facet name="header">Delivered</apex:facet>
                        <apex:outputText value="{!o.number_of_items_delivered__c}"/>
                </apex:column>   
                <apex:column >
                        <apex:facet name="header">Order Date</apex:facet>
                        <apex:outputText value="{0, date, MM/d/yyyy}"> 
                        <apex:param value="{!o.order_date__c}"/>
                        </apex:outputText>                         
                </apex:column>                                                                                               
        </apex:pageBlockTable>
        <apex:form>
        <apex:selectList id="mgr" value="" size="1" title="Manager">
                        <apex:selectOptions value=""></apex:selectOptions>
        </apex:selectList>
        </apex:form>
<script type="text/javascript" language="javascript" src="{!URLFOR($Resource.jQueryDataTablesZip, 'jQueryDataTablesZip/js/jquery.js')}"></script>
<script type="text/javascript" language="javascript" src="{!URLFOR($Resource.jQueryDataTablesZip, 'jQueryDataTablesZip/js/jquery.dataTables.js')}"></script>
     
 </apex:pageBlock>    

</apex:page>
Thanks in advance!
 
AbdelhakimAbdelhakim
Hi,
You can find the solution in this URL :
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/apex_pages_selectoption.htm

Please mark it as a best answer if it helps.
Thanks,