You need to sign in to do that
Don't have an account?

I need Total no of contacts and Accounts in Home tab?
Dear Friends,
I need to see how many contacts and Accounts in my organisation in Home tab with out use Vf.
Note:Only no of candidates only not view of all candidates.
Please tell me friends.
I need to see how many contacts and Accounts in my organisation in Home tab with out use Vf.
Note:Only no of candidates only not view of all candidates.
Please tell me friends.
Here is code:
1.Controller:
Public class counter {
integer totalacc;
integer totalcont;
public integer getacc() {
totalacc=[select count() from account];
return totalacc;
}
public integer getcont() {
totalcont=[select count() from contact];
return totalcont;
}
}
2.VF Page:
<apex:page controller="counter" showChat="false" showHeader="false" setup="false" sidebar="false">
<apex:form >
<apex:pageBlock title="Here are the counts">
<apex:pageBlockSection title="Number of Accounts:">
<apex:outputText value="{!acc}"></apex:outputText>
</apex:pageBlockSection>
<apex:pageBlockSection title="Number of Contacts :">
<apex:outputText value="{!cont}"></apex:outputText>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
3. Include this VF page as Home page component and add it on home page layout.
Thanks,
Pratik
P.S. If this answers you question, please mark it as "Best Answer" so it will help other community members too.
All Answers
Here is code:
1.Controller:
Public class counter {
integer totalacc;
integer totalcont;
public integer getacc() {
totalacc=[select count() from account];
return totalacc;
}
public integer getcont() {
totalcont=[select count() from contact];
return totalcont;
}
}
2.VF Page:
<apex:page controller="counter" showChat="false" showHeader="false" setup="false" sidebar="false">
<apex:form >
<apex:pageBlock title="Here are the counts">
<apex:pageBlockSection title="Number of Accounts:">
<apex:outputText value="{!acc}"></apex:outputText>
</apex:pageBlockSection>
<apex:pageBlockSection title="Number of Contacts :">
<apex:outputText value="{!cont}"></apex:outputText>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
3. Include this VF page as Home page component and add it on home page layout.
Thanks,
Pratik
P.S. If this answers you question, please mark it as "Best Answer" so it will help other community members too.
Almost all Ok .....when after adding to home components it's showing direct vf coding ....
don't main can u please give me brief steps for adding vf in home components.
Once you are done with saving Controller and VF page, Go To:
Setup->customize->Home->Homepage Components->New -> Select Visualforce Area and then select VF page.
Screenshot:
Here "showcount" is the name of my VF page.
Then add this component on home pagelayout at appropriate position.
It looks like this:
Screenshot:
Thanks,
Pratik