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
SFDCmack08180939826349907SFDCmack08180939826349907 

I am trying to build a visualforce page that shows the Account names, their related territories, and user field isActive

I am stuck trying to get the Group query to get the territory name, could someone let me know what I am doing wrong here, I get this error message
'Initial term of field expression must be a concrete SObject: List<AccountShare>'

VF:
 
<apex:page controller="DisplayQueryList"> 
    <apex:pageBlock title="My Content"> 
        <apex:pageBlockTable value="{!Recs}" var="Record"> 
            <apex:column > 
                <apex:facet name="header">User</apex:facet> 
                  <apex:outputText value="{!Record.Id}"/> 
                    </apex:column>
<apex:column > 
                <apex:facet name="header">UserID or Group</apex:facet> 
                  <apex:outputText value="{!Record.UserOrGroupId}"/> 
                    </apex:column>

          
            
          
          
                        
        </apex:pageBlockTable> 
    </apex:pageBlock> 
</apex:page>



Apex:
 
public with sharing class TestDisplayQueryList{ 
public List<AccountShare> Recs {get; set;} 
public DisplayQueryList(){ 

Rec = [Select Id, UserOrGroupId from AccountShare where (RowCause ='Territory' OR RowCause = 'TerritoryManual' )And AccountId='001i0000009Rmz5' ];    
Group grp =[select id from Group where id IN :Records.id ];
   


} 
}

 
Best Answer chosen by SFDCmack08180939826349907
Siva@51Siva@51
Try this

public with sharing class TestDisplayQueryList{
public List<AccountShare> Recs {get; set;}
public TestDisplayQueryList(){

Recs = [Select Id, UserOrGroupId from AccountShare where (RowCause ='Territory' OR RowCause = 'TerritoryManual' )And AccountId='001i0000009Rmz5' ];    
Group grp =[select id from Group where Id =: Recs[0].Id ];

}
}

Thank you :)

All Answers

SFDCmack08180939826349907SFDCmack08180939826349907
I still get the same errors I am wondering if I should do a for loop
Siva@51Siva@51
Try this

public with sharing class TestDisplayQueryList{
public List<AccountShare> Recs {get; set;}
public TestDisplayQueryList(){

Recs = [Select Id, UserOrGroupId from AccountShare where (RowCause ='Territory' OR RowCause = 'TerritoryManual' )And AccountId='001i0000009Rmz5' ];    
Group grp =[select id from Group where Id =: Recs[0].Id ];

}
}

Thank you :)
This was selected as the best answer
SFDCmack08180939826349907SFDCmack08180939826349907
The Recs[0] makes sense it worked thanks