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
SFDC_biSFDC_bi 

I want to display listview count based on current user

Can you please help me to display list view count in the vf page.

Controller:
public with sharing class pipeLineController {

public Integer unread{get;set;}
private Lead lead;
private User user;
private Opportunity opp;

 public Void LeadListValues()
    {
            lead = [Select Id, owner.id,status from Lead];
            user = [select id,firstname from user where id=:userinfo.getuserid()];
            Id currentUserId = UserInfo.getUserId();
            
            unread = 0;
            
             AggregateResult[] groupedResultOAB =[SELECT count(Id)unread FROM Lead where IsUnreadByOwner = true and Owner.Id = :currentUserId and status IN ('Contacted by Aramex','Unread','Pending','Follow Up','Contacted')];        
            //    System.debug('groupedResultOAB = = '+groupedResultOAB);
            unread=Integer.valueof(groupedResultOAB [0].get('unread'));
            
            }
}
VFpage
<apex:page Controller="pipeLineController"  sidebar="false" >
<style>

        .bal, .bal td,.bal th {    
            border: 1px solid #ddd;        
        }
        .datacol{
        }
        
        .bal{
            border-collapse: collapse;
            width: 100%;
        }
        
        .bal th, .bal td {
            padding: 5px;
        }
        
        .imgclass:hover{ 
            background-image: url(/img/help/helpOrbs.gif); 
            background-repeat: no-repeat; 
            width: 16px; 
            height: 15px; 
            background-position: right; 
            vertical-align: middle;
        } 
        .imgclass{ 
            background-image: url(/img/help/helpOrbs.gif); 
            background-repeat: no-repeat; 
            width: 16px; 
            height: 15px; 
            vertical-align: middle;
        } 


body 
.bPageBlock, 
body #bodyCell .bResource .secondaryPalette, 
body .secondaryPalette.bPageBlock, 
body .individualPalette .secondaryPalette.bPageBlock, 
body .bodyDiv .genericTable, 
body .genericPageBlockTable, 
body .bodyDiv .bSubBlock, 
body .bComponentBlock .bPageBlock, 
body .bMyDashboard .bPageBlock,
body.rlHoverFrame .bPageBlock,
body.subjectSelectionPopup div.choicesBox,
body.lookupTab .secondaryPalette.bPageBlock,
body.popupTab .secondaryPalette.bPageBlock,
body.UserTagStatsPage .secondaryPalette.bPageBlock {

    background-color: white;

    border-bottom: 1px solid black;

    border-left: 1px solid black;

    border-radius: 4px 4px 4px 4px;

    border-right: 1px solid black;

    border-top: 5px solid BLUE;

}

</style>
<apex:form >
 <apex:pageBlock title="welcome back {!$User.LastName}, follows your pipelines" tabStyle="account" >
<apex:pageBlockSection title="Leads" collapsible="true" >

  
  <table class="bal" style="width:100%">    
        <tr>
            <!-- <th>List Name</th>
            <th>Values</th> -->
            </tr>
         <tr>
            <apex:outputText value="{!unread}"> </apex:outputText> 
            <td>        
                 <a href="/00Q?fcf=00B0C000000yzUH" target="_blank">Unread
         
                   
                </a> 
            
              
            </td>
        </tr>
         <tr>
            <td>Unread</td>
            <td>        
                 <a href="/00Q?fcf=00B0C000000yzUH" target="_blank">O
         
                   
                </a> 
            
              
            </td>
        </tr>
    </table>  
    
</apex:pageBlockSection>

</apex:pageBlock> 
  



</apex:form>

</apex:page>

Thanks in Advance!!!
ANUTEJANUTEJ (Salesforce Developers) 
Hi SFDC_bi,

I think you can get the profile of the current user and according to which you can render your logic.

You can use {!$Profile.Name} or {!$Profile.Id} to check for profile.

>> https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_variables_global_profile.htm

Hope this helped you please close the thread by marking a best answer so that it is useful for others in the future and also helps in keeping the community clean.

Regards,
Anutej