• Ravi sastri
  • NEWBIE
  • 25 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 20
    Questions
  • 10
    Replies
I have a code where the JSON will be extracted using a certain end point. This JSON contains Parent to Grandchild like Structure where Parent is Bundle, Child is Item and GrandChild is Component. When I tried to retrieve the JSON using POSTMAN, I have recieved following response
 
{
"message": "Starting position out of bounds: -1",
"isSuccess": false,
"bundles": null }


Here, bundles is parent object. Can anyone let me know how to resolve this issue. Thanks
Hi,
I have three objects viz., qACC , qCON and qOLC. Now from these three objects, I have different fields as follows
qACC- 'Country', 'Year','Month'
qCON- 'Country__c','PROC_YR','PROC_MO'
qOLC- 'Coun', 'Pro_Year','Pro_Mon', 'Closed_Date'

In the third object i.e qOLC, I have 4th field Closed_Date that is not available in the remianing two objects. When I co-group these three objects, it is throwing me an error stating that mismatch of columns in co-group.
I tried giving null field in remianing two objects in co-group, but that didn't work.
Can anyone please help me achieivng this.

Thank you in advance
Issue with Co-grouping
Hello Guys,

I have a requirement where we need to cogroup 3 datasets which contains fields such as Country, year and month. But in the 3rd dataset, we have an additional field as Closed Date. This field will give result in the combination of Country, month and Year.

So in the co-group, for this 3rd dataset, if we include Closed Date along with Country, month and year., we are recieving this error "Mismatched number of cogrouped columns: 3 and 4"

Cogroup statement- 
cogroup qACC by ('Country', 'Year','Month'), qCON by ('Country__c','PROC_YR','PROC_MO'), qOLC by ('Coun', 'Pro_Year','Pro_Mon', 'Closed_Date');
 

Can anyone please advice on how to do this grouping or is there any other alternative to get this done.
 
Thanks,
Sastri
As salesforce old wave dashboards are getting expired in June'19, we have around 19 dashboards to convert to new dashboard design. As the old widgets and other components are not editable in old dashboards, I am unable to convert the dashboard into newer version. Also, these dashboards are built in 2016 and we do not have those requirements in order build from scratch.
Is there any other better solution to convert old wave dashboard to newer version.
Please help
I have a requirement where users need to log in to salesforce using external authentication provider. The configuration in Open-id authentication. I have created the connection in Auth.Providers along with all the required key, id, url and tokens. Salesforce has automatically created a registration handler. Using Test-Only Initialization URL, I have tested the connection and I have recieved the XML which states that the connection is working fine

Now, I need the users to log in using that provider and should be redirected to Home Page of Salesforce. How to do that? Please help.

Thank you in advance.
Sastri
I have a requirement in **Wave Analytics** where I need to fetch records from Previous year when current year is completed. I have a field named Processing Year. It now fetches 2017 records which we have hard coded. But when we move to 2019, it need to fetch 2018 records. I have tried lot of options but nothing seems to be worked out. 

Something like Current Year-1 will work. 
Any help will be highly appreciated.

Thank you in advance
Hello Admins and Developers,

I have a requirement where the calendars should be shared based on role/profiles. For eg: I have a profile named Marketing. This Marketing profile user's calendar should be shared with Sales Manager Profile. Sales Manager Profile users can see Marketing profile user's Calendar.. I know I can do this using public calendars from  setup but I cannot find any button or option regarding this in Lightning. 

In Lightning view, a calendar can be shared with a user but I need a calendar sharing in profile level. I have also gone through Salesfoce's PDF document but didn't find it helpful.
Can anyone help me solving this in detail. 

Thank you in advance.
Sastri.
I have a requirement where the vf page should display parent's child record when searched from lookup. TO be precise, there are three objects. Class, Students and Attendance tracker.
Class is the parent of both of these objects. When class record is searched from attendance lookup, students records should display. 
Below is my code.
 
public class AttendenceController {
    public Class__C selectedUser { get; set; }
    public student__c stu {get; set;}
    public string recid{get;set;}
    public List<Attendance_Tracker__c> contacts {get; set;}
    public class StudentWrapper {   
        public Student__c student {get; set;} 
        public Boolean absent {get; set;}
        
        public StudentWrapper() {
            this.absent = false;
        }
        
        public StudentWrapper(Student__c student) {
            this();
            this.student = student;
        }
    }
    
    public List<StudentWrapper> students {get; set;}
    
    Date day = Date.today();
    
    public AttendenceController() {
        students = new List<StudentWrapper>();
        
        for (Student__c student : [select Name, Class__c from Student__c WHERE Class__C!= Null]) {
            students.add(new StudentWrapper(student));
        }
    } 
    
    public PageReference submit() {
        List<Attendance_Tracker__c> attendance = new List<Attendance_Tracker__c>();
        
        for (StudentWrapper wrapper : this.students) {
            attendance.add(new Attendance_Tracker__c(
                Date__c = this.day,
                Student__c = wrapper.student.Id,
                Present_Today__c = wrapper.absent, Class_del__c = wrapper.student.Class__c
            ));
        }
        
        if (!attendance.isEmpty()) {
            insert attendance;
        }
        
        return null;
    }
    
    public Attendance_Tracker__c getCurrentAccount(){
        
        return [Select Id, Class_del__c from Attendance_Tracker__c limit 1];
}
  
}

vf page
 
<apex:page controller="AttendenceController">
<apex:form >
    <apex:pageBlock >
    <b> Select Class:</b>   <apex:inputField required="true" value="{!CurrentAccount.Class_del__c}"/>
        <apex:pageBlockTable value="{!students}" var="wrapper">
            <apex:column value="{!wrapper.student.Name}" />
            <apex:column >
                <apex:facet name="header">Present Today</apex:facet>
                <apex:inputCheckbox value="{!wrapper.absent}" />
            </apex:column>
        </apex:pageBlockTable>
    </apex:pageBlock>
    <apex:commandButton action="{!submit}" value="Submit" onComplete="window.location.reload();"/>
</apex:form>
</apex:page>

I have managed till displaying lookup on page but i cannot able to display button which pulls student's records. Please review this and help me in achieivng the above mentioned scenario.

Thank you in advance
Sastri
I have a requirement to display report associated with the account number in vf page.
When the account number is entered in the vf page and hit enter, the concern report should be displayed in the same page.
Can anyone help me with the functionality.
Thanks in advance
Ravi
Hi Folks,
I have a requirement where I need to translate "Week" on Calender. There are translations already for week days but I cannot figure out from where did they came. PFA of screenshot below
User-added image
Can anyone please help me with this
Hello Developers,
I have some email templates which will be sent to end users by account owners. These email templates are of Visualforce type. They contains links which will be redirected to outside of salesforce. Everything is working fine here. But, when the user clicks the URL and when it moves outside of salesforce, it does not store any of account owner information. Due to this, the account owner is not able to recieve his/her credits.
Can anyone of you help me with how to store(embed) account owner information along with the URL so that the account owners can recieve their credits.

Thank you in advance
Ravi
Hi Developers,
Quotes will be auto sorted in Salesforce classic but where as in Salesforce Lightning, it doesn't. So I came up with a tool from app exchange called Alpha sort. It works fine but the UI is clumsy and it is redirecting to salesforce classic for sorting of the quotes which annoys users. Moreover, this functionality is only available for one time use per Quote.

Hence, can anyone please help me with developing Lightning Component for auto sorting of Quote in Salesforce Lightning. Or is there any other alternative...?

Any help will be highly appreciated.

Thanks in advance,
Ravi
Hello Admins and Develpers,
I have a task where the Lead Owner field should be updated when Account Owner field on Lead is updated. This field contains names of users. When a user is selected from Account owner picklist, the lead owner should change to that user. I do have a trigger but I wanna try this out without a peice of code. Can anyone help me with developing workflow rules or process builder in order to achieve this.
Hi Developers,
I'm new to salesforce. Below is my Trigger to Update lead Owner when Account owner field on Lead is updated. Can anyone help me with writing the test class for this code. 
trigger UpdateLeadOwner on Lead (before insert, before update) {
List<String> AccOwnerPicklist =  new List<String>();
    for(Lead L : Trigger.New){
        if(L.Account_Onwer__c != Null){  
            AccOwnerPicklist.add(L.Account_Onwer__c);
        } 
    }
    List<User> UserList = [select id, name from user where name IN :AccOwnerPicklist];
    
    if(UserList != NULL && UserList.size()>0){
        for(Lead L : Trigger.New){
            for(User U : UserList){
                if(L.Account_Onwer__c == U.Name){
                    L.OwnerId = U.Id;
                }
            }
        }
    }
}

Any help will be highly appriciated.

Thank you in advance
Ravi
Hello Developers,
I've a sandbox org where I cannot able to write triggers and apex classes. As they say, it is nt possible n production org but mine is sandbox. Can you please let me know the reason and steps to overcome that.

Thanks in advance
Sastri
Hello Admins and Developers,
I've a requirement where Lead owner should change when Account owner is changed on lead object. Here, Account Owner field is a picklist type. When an option from account owner picklist is selected, the same value should be displayed on the lead owner field. I'm pretty much confused how to crack this requirement. Any suggestion with Workflow rule or Trigger will be highly helpful.

Thanks in advance
Sastri
Hello Developerss,
I have a requirement where I need to replace standard new and edit buttons on record page with VF page. Below is the code which I have got so far.
<apex:page standardcontroller="Lead" tabstyle="Lead" extensions="ExtensionClass">
 
 <apex:form>
 
 <apex:sectionheader title="Lead Edit" subtitle="{!if(Lead.Id==null,'New Lead',Lead.Name)}"></apex:sectionheader>
 
 <apex:pageblock mode="edit" id="leadPB" title="Lead Edit">
 
 <apex:pageblockbuttons>
 <apex:commandbutton action="{!save}" value="Save"></apex:commandbutton>
 <apex:commandbutton action="{!cancel}" value="Cancel"></apex:commandbutton>
 </apex:pageblockbuttons>
 
 <apex:pagemessages></apex:pagemessages> <!-- displays all message generated by the component -->
 
 <apex:pageblocksection id="LeadInformationPBS" title="Lead Information">
 <apex:inputField value="{!Lead.OwnerId}"/> 
 <apex:inputfield value="{!Lead.Phone}"></apex:inputfield>

 <apex:pageblocksectionitem>
 <apex:outputlabel value="{!$ObjectType.Lead.Fields.FirstName.label}"></apex:outputlabel>
 <apex:outputpanel>
 <apex:inputfield value="{!Lead.Salutation}"></apex:inputfield>
 <apex:inputfield value="{!Lead.FirstName}"></apex:inputfield>
 </apex:outputpanel>
 </apex:pageblocksectionitem>
 <apex:inputfield value="{!Lead.MobilePhone}"></apex:inputfield>
 
 <apex:inputfield value="{!Lead.LastName}"></apex:inputfield>
 <apex:inputfield value="{!Lead.Fax}"></apex:inputfield>
 
 <apex:inputField value="{!Lead.Company}" />
 <apex:inputfield value="{!Lead.Email}" required="true"></apex:inputfield>
 
 <apex:inputfield value="{!Lead.Title}"></apex:inputfield>
 <apex:inputfield value="{!Lead.Website}"></apex:inputfield>
 
 <apex:inputfield value="{!Lead.Leadsource}"></apex:inputfield>
 <apex:inputfield value="{!Lead.Status}"></apex:inputfield>

 <apex:inputfield value="{!Lead.Rating}"></apex:inputfield>
 
 <apex:inputfield value="{!Lead.Industry}"></apex:inputfield>
 <apex:inputfield value="{!Lead.NumberOfEmployees}"></apex:inputfield>
     <apex:actionRegion >
         Target Sectors:  <apex:inputfield value="{!Lead.Target_Sectors__c}">
                                      <apex:actionSupport event="onchange" rerender="TargetSector,theMessage"/> 
                                      </apex:inputfield>
                                  </apex:actionRegion>
      <apex:outputPanel id="TargetSector">
                      <apex:pageBlockSection id="ProdFamily"  rendered="{!IF(Lead.Target_Sectors__c == 'Other', true, false)}"> 
                            <apex:inputfield value="{!Lead.Please_specify_the_Other_reason__c}"/>
                 </apex:pageBlockSection> 
    </apex:outputPanel> 
 </apex:pageblocksection>
 
 <apex:pageblocksection id="AddressInformationPBS" title="Address Information" columns="2">
 <apex:inputfield value="{!Lead.Street}"></apex:inputfield>
 <apex:outputtext value=""></apex:outputtext>
 
  <apex:inputfield value="{!Lead.Website}"></apex:inputfield>
 <apex:outputtext value=""></apex:outputtext>
 
 <apex:inputfield value="{!Lead.City}"></apex:inputfield>
 <apex:outputtext value=""></apex:outputtext>
 
 <apex:inputfield value="{!Lead.State}"></apex:inputfield>
 <apex:outputtext value=""></apex:outputtext>
 
 <apex:inputfield value="{!Lead.PostalCode}"></apex:inputfield>
 <apex:outputtext value=""></apex:outputtext>
 
 <apex:inputfield value="{!Lead.Country}"></apex:inputfield>
 <apex:outputtext value=""></apex:outputtext> 
 </apex:pageblocksection>
 
 <apex:pageblocksection id="AdditionalInformationPBS" title="Additional Information">
 <apex:inputfield value="{!Lead.ProductInterest__c}"></apex:inputfield>
 <apex:inputfield value="{!Lead.CurrentGenerators__c}"></apex:inputfield>
 
 <apex:inputfield value="{!Lead.SICCode__c}"></apex:inputfield>
 <apex:inputfield value="{!Lead.Primary__c}"></apex:inputfield>
 
 <apex:inputfield value="{!Lead.NumberofLocations__c}"></apex:inputfield>
 </apex:pageblocksection>
 
 <apex:pageblocksection id="DescriptionInformationPBS" title="DescriptionInformation">
 <apex:inputfield value="{!Lead.Description}"></apex:inputfield>
 </apex:pageblocksection>
 
 <apex:pageblocksection id="OptionPBS" title="Lead Information">
 <!-- If you want to have a checkbox to implement whether to use Active Assignment rules you will need to create your own using a custom Apex Extension and method -->
 </apex:pageblocksection>
 
 </apex:pageblock>
 
 </apex:form>
 
</apex:page>

Everything works fine here. I have replaced this vf page with standard New button and it works fine.
1) But, I do not know how to bind edit button with this page as it has to pre populate values which were entered while creating new record.
2) Save and Cancel buttons are working fine here. Can anyone help me with Save&New functionality with custom apex code.
3) In the above code, there is a field called "Target Sectors". It is enclosed under <apex:actionregion> tag. The name of this field is not populating on the page(Please test this code in your DE for better understanding).

Can anyone help me with above queries as I'm running out of time. Bieng a newbie, I couldnot able to catch what is the better solution for this. 
Thanks in advance
RS
Hello Admins, I am new to salesforce
Can anyone help me out with below mentioned requirement,
I need to write a workflow rule to create an Account on Incoming Email and pull the account details like the Name, Mobile, Country and address to be pulled from the Incoming email text and populated on the Account object

Thanks in Advance
Sastri
Hello Developers,
Below is my code to find total number of contacts for an account. Everything works fine here. I need to write a test class for this code. Can anyone help me with this....
trigger TriggerCntact on Contact (after insert, after delete) {
	set<ID> accSet = new Set<Id>();
    if(trigger.isinsert){
        for(Contact Con : Trigger.new){
            accSet.add(con.AccountId);
        }
    }
        if(trigger.isDelete){
        for(Contact Con : Trigger.old){
            accSet.add(con.AccountId);
        }
    }
    List<Account> acclist = [SELECT Id from Account WHERE ID IN :accSet];
    List<Contact> conlist = [SELECT AccountId FROM Contact WHERE AccountId IN :accSet];
    list<Contact> listCon = new List<Contact>();
    list<Account> listacc = new List<Account>();
    map<String, Integer> conMap = new Map<String, Integer>();
    for(Account acnt : acclist){
        listCon.clear();
        for(contact cont : conlist){
            if(cont.AccountId == acnt.Id){
                listcon.add(cont);
            ConMap.put(cont.AccountId, listCon.size());
            }
        }
    }
    if(acclist.size()>0){
        for(account a : acclist){
            if(conMap.get(a.Id)==NULL){
                a.Total_Contacts__c	= 0;
            }
            else{
                a.Total_Contacts__c	= ConMap.get(a.Id);
                listacc.add(a);
            }
        }
        if(listacc.size()>0){
            update Listacc;
        }
    }
}

Thanks in Advance!!​
Hello Developers,
Below is the requirement
I have a custom object with status and button where if the Status is "In Progress" then the button might say "Submit Order" which when pressed, changes the Order Status to "Order Submitted" and then removes that button and replaces it with one such as "Complete Order." Can anyone please mention the template or demo code so that I can proceed.
I have a requirement in **Wave Analytics** where I need to fetch records from Previous year when current year is completed. I have a field named Processing Year. It now fetches 2017 records which we have hard coded. But when we move to 2019, it need to fetch 2018 records. I have tried lot of options but nothing seems to be worked out. 

Something like Current Year-1 will work. 
Any help will be highly appreciated.

Thank you in advance
Hello Developers,
I have some email templates which will be sent to end users by account owners. These email templates are of Visualforce type. They contains links which will be redirected to outside of salesforce. Everything is working fine here. But, when the user clicks the URL and when it moves outside of salesforce, it does not store any of account owner information. Due to this, the account owner is not able to recieve his/her credits.
Can anyone of you help me with how to store(embed) account owner information along with the URL so that the account owners can recieve their credits.

Thank you in advance
Ravi
Hi Developers,
I'm new to salesforce. Below is my Trigger to Update lead Owner when Account owner field on Lead is updated. Can anyone help me with writing the test class for this code. 
trigger UpdateLeadOwner on Lead (before insert, before update) {
List<String> AccOwnerPicklist =  new List<String>();
    for(Lead L : Trigger.New){
        if(L.Account_Onwer__c != Null){  
            AccOwnerPicklist.add(L.Account_Onwer__c);
        } 
    }
    List<User> UserList = [select id, name from user where name IN :AccOwnerPicklist];
    
    if(UserList != NULL && UserList.size()>0){
        for(Lead L : Trigger.New){
            for(User U : UserList){
                if(L.Account_Onwer__c == U.Name){
                    L.OwnerId = U.Id;
                }
            }
        }
    }
}

Any help will be highly appriciated.

Thank you in advance
Ravi
Hello Admins and Developers,
I've a requirement where Lead owner should change when Account owner is changed on lead object. Here, Account Owner field is a picklist type. When an option from account owner picklist is selected, the same value should be displayed on the lead owner field. I'm pretty much confused how to crack this requirement. Any suggestion with Workflow rule or Trigger will be highly helpful.

Thanks in advance
Sastri
Hello Developerss,
I have a requirement where I need to replace standard new and edit buttons on record page with VF page. Below is the code which I have got so far.
<apex:page standardcontroller="Lead" tabstyle="Lead" extensions="ExtensionClass">
 
 <apex:form>
 
 <apex:sectionheader title="Lead Edit" subtitle="{!if(Lead.Id==null,'New Lead',Lead.Name)}"></apex:sectionheader>
 
 <apex:pageblock mode="edit" id="leadPB" title="Lead Edit">
 
 <apex:pageblockbuttons>
 <apex:commandbutton action="{!save}" value="Save"></apex:commandbutton>
 <apex:commandbutton action="{!cancel}" value="Cancel"></apex:commandbutton>
 </apex:pageblockbuttons>
 
 <apex:pagemessages></apex:pagemessages> <!-- displays all message generated by the component -->
 
 <apex:pageblocksection id="LeadInformationPBS" title="Lead Information">
 <apex:inputField value="{!Lead.OwnerId}"/> 
 <apex:inputfield value="{!Lead.Phone}"></apex:inputfield>

 <apex:pageblocksectionitem>
 <apex:outputlabel value="{!$ObjectType.Lead.Fields.FirstName.label}"></apex:outputlabel>
 <apex:outputpanel>
 <apex:inputfield value="{!Lead.Salutation}"></apex:inputfield>
 <apex:inputfield value="{!Lead.FirstName}"></apex:inputfield>
 </apex:outputpanel>
 </apex:pageblocksectionitem>
 <apex:inputfield value="{!Lead.MobilePhone}"></apex:inputfield>
 
 <apex:inputfield value="{!Lead.LastName}"></apex:inputfield>
 <apex:inputfield value="{!Lead.Fax}"></apex:inputfield>
 
 <apex:inputField value="{!Lead.Company}" />
 <apex:inputfield value="{!Lead.Email}" required="true"></apex:inputfield>
 
 <apex:inputfield value="{!Lead.Title}"></apex:inputfield>
 <apex:inputfield value="{!Lead.Website}"></apex:inputfield>
 
 <apex:inputfield value="{!Lead.Leadsource}"></apex:inputfield>
 <apex:inputfield value="{!Lead.Status}"></apex:inputfield>

 <apex:inputfield value="{!Lead.Rating}"></apex:inputfield>
 
 <apex:inputfield value="{!Lead.Industry}"></apex:inputfield>
 <apex:inputfield value="{!Lead.NumberOfEmployees}"></apex:inputfield>
     <apex:actionRegion >
         Target Sectors:  <apex:inputfield value="{!Lead.Target_Sectors__c}">
                                      <apex:actionSupport event="onchange" rerender="TargetSector,theMessage"/> 
                                      </apex:inputfield>
                                  </apex:actionRegion>
      <apex:outputPanel id="TargetSector">
                      <apex:pageBlockSection id="ProdFamily"  rendered="{!IF(Lead.Target_Sectors__c == 'Other', true, false)}"> 
                            <apex:inputfield value="{!Lead.Please_specify_the_Other_reason__c}"/>
                 </apex:pageBlockSection> 
    </apex:outputPanel> 
 </apex:pageblocksection>
 
 <apex:pageblocksection id="AddressInformationPBS" title="Address Information" columns="2">
 <apex:inputfield value="{!Lead.Street}"></apex:inputfield>
 <apex:outputtext value=""></apex:outputtext>
 
  <apex:inputfield value="{!Lead.Website}"></apex:inputfield>
 <apex:outputtext value=""></apex:outputtext>
 
 <apex:inputfield value="{!Lead.City}"></apex:inputfield>
 <apex:outputtext value=""></apex:outputtext>
 
 <apex:inputfield value="{!Lead.State}"></apex:inputfield>
 <apex:outputtext value=""></apex:outputtext>
 
 <apex:inputfield value="{!Lead.PostalCode}"></apex:inputfield>
 <apex:outputtext value=""></apex:outputtext>
 
 <apex:inputfield value="{!Lead.Country}"></apex:inputfield>
 <apex:outputtext value=""></apex:outputtext> 
 </apex:pageblocksection>
 
 <apex:pageblocksection id="AdditionalInformationPBS" title="Additional Information">
 <apex:inputfield value="{!Lead.ProductInterest__c}"></apex:inputfield>
 <apex:inputfield value="{!Lead.CurrentGenerators__c}"></apex:inputfield>
 
 <apex:inputfield value="{!Lead.SICCode__c}"></apex:inputfield>
 <apex:inputfield value="{!Lead.Primary__c}"></apex:inputfield>
 
 <apex:inputfield value="{!Lead.NumberofLocations__c}"></apex:inputfield>
 </apex:pageblocksection>
 
 <apex:pageblocksection id="DescriptionInformationPBS" title="DescriptionInformation">
 <apex:inputfield value="{!Lead.Description}"></apex:inputfield>
 </apex:pageblocksection>
 
 <apex:pageblocksection id="OptionPBS" title="Lead Information">
 <!-- If you want to have a checkbox to implement whether to use Active Assignment rules you will need to create your own using a custom Apex Extension and method -->
 </apex:pageblocksection>
 
 </apex:pageblock>
 
 </apex:form>
 
</apex:page>

Everything works fine here. I have replaced this vf page with standard New button and it works fine.
1) But, I do not know how to bind edit button with this page as it has to pre populate values which were entered while creating new record.
2) Save and Cancel buttons are working fine here. Can anyone help me with Save&New functionality with custom apex code.
3) In the above code, there is a field called "Target Sectors". It is enclosed under <apex:actionregion> tag. The name of this field is not populating on the page(Please test this code in your DE for better understanding).

Can anyone help me with above queries as I'm running out of time. Bieng a newbie, I couldnot able to catch what is the better solution for this. 
Thanks in advance
RS
Hello Developers,
Below is my code to find total number of contacts for an account. Everything works fine here. I need to write a test class for this code. Can anyone help me with this....
trigger TriggerCntact on Contact (after insert, after delete) {
	set<ID> accSet = new Set<Id>();
    if(trigger.isinsert){
        for(Contact Con : Trigger.new){
            accSet.add(con.AccountId);
        }
    }
        if(trigger.isDelete){
        for(Contact Con : Trigger.old){
            accSet.add(con.AccountId);
        }
    }
    List<Account> acclist = [SELECT Id from Account WHERE ID IN :accSet];
    List<Contact> conlist = [SELECT AccountId FROM Contact WHERE AccountId IN :accSet];
    list<Contact> listCon = new List<Contact>();
    list<Account> listacc = new List<Account>();
    map<String, Integer> conMap = new Map<String, Integer>();
    for(Account acnt : acclist){
        listCon.clear();
        for(contact cont : conlist){
            if(cont.AccountId == acnt.Id){
                listcon.add(cont);
            ConMap.put(cont.AccountId, listCon.size());
            }
        }
    }
    if(acclist.size()>0){
        for(account a : acclist){
            if(conMap.get(a.Id)==NULL){
                a.Total_Contacts__c	= 0;
            }
            else{
                a.Total_Contacts__c	= ConMap.get(a.Id);
                listacc.add(a);
            }
        }
        if(listacc.size()>0){
            update Listacc;
        }
    }
}

Thanks in Advance!!​
HI,  I'm working with community and in case detail page if i place the cursor on hover links  the complete page is  keep on refreshing it is having issue only on detail page.. any solution for this ?