• Sandeep M 1
  • NEWBIE
  • 35 Points
  • Member since 2014

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 19
    Questions
  • 21
    Replies

Iam trying to count the number of contacts on account, Iam getting the following error message

Error: Compile Error: Initial term of field expression must be a concrete SObject: LIST<Account> at line 10 column 1    

Trigger counting on contact(after update,after insert){
Set<account> accids=New Set<Account>();
For(contact c:trigger.new){
Accids.add(c.Account);
}
List<Contact> con = [select id  from contact where AccountID IN:accids];
List<Account> Acc=[Select count__C from account where id IN:accids ];
For(contact c:trigger.new)
{
Acc.count__c=con.size();
}
}
Hi folks,
         Can anyone tell me what are the hottest topics in salesforce?
I need atleast 20 topic names.

 
I am trying to count the number of contacts associated with the account.Code is saved , but  not works.Please help me.

Trigger counting on contact(after update,after insert){
List<account> accids=New list<Account>();
For(contact con:trigger.new){
Accids.add(con.account);
}
For(contact con:trigger.new)
{
Account Acc;
Acc.count__c=accids.size();
}
}
have two objects SFDC_PTO_Request__c (child),Employee__c (parent) with Master-Detail relationship. I need to display parent on child record while inserting on visualforce page which was a lookup relationship. I am trying as below

<apex:page standardController="SFDC_PTO_Request__c" recordSetVar="SFDC_PTO_Request" sidebar="false">
<apex:form >
<apex:pageBlock title="Leave Request Edit">
<apex:pageBlockButtons >
     <apex:commandButton action="{!Save}" value="Save"/>
     <apex:commandButton action="{!Cancel}" value="Cancel"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Information" columns="2" collapsible="false">
      <apex:inputField value="{!SFDC_PTO_Request__c.Type_of_leave__c}"/>
      <apex:inputField value="{!SFDC_PTO_Request__c.Available_Casual_Leaves__c}"/>    
      <apex:inputField value="{!SFDC_PTO_Request__c.Available_Sick_Leaves__c}"/>  
      <apex:inputField value="{!SFDC_PTO_Request__c.Request_Type__c}"/>  
      <apex:inputField value="{!SFDC_PTO_Request__c.Employee__c}"/>
</apex:pageBlockSection>
  <apex:pageBlockSection title="Request Dates" columns="2" collapsible="false">
      <apex:inputField value="{!SFDC_PTO_Request__c.Request_Start_Date__c}"/>
      <apex:inputField value="{!SFDC_PTO_Request__c.Request_End_Date__c}"/> 
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

User-added image

could some one help me to display the lookup field of parent on child record
I have a controller without any dml statements. How can i write test class for the controller to improve the coverage area ?
public with sharing class payslipController

public Decimal loandeduction { get; set; }
public Decimal oIncome { get; set; }
public Decimal Asleaves { get; set; }
public Decimal tsleaves { get; set; }
public Decimal Acleaves { get; set; }
public Decimal tcleaves { get; set; }
public Decimal tds { get; set; }
public Decimal tnetsalary { get; set; }
public Decimal tdeduce { get; set; }
public Decimal pt { get; set; }
public Decimal pf { get; set; }
public Decimal tsalaryAmount { get; set; }
public Decimal obAmount { get; set; }
public Decimal caAmount { get; set; }
public Decimal hraAmount { get; set; }
public Decimal deductions { get; set; }
public Decimal bSalary { get; set; }
public Decimal lwp { get; set; }
public Decimal holidays { get; set; }
public Decimal workingDays { get; set; }
public Integer no_days { get; set; }
public String email { get; set; }
public String gender { get; set; }
public String designation { get; set; }
public String doj { get; set; }
public String panNumber { get; set; }
public String AccountNumber { get; set; }
public String empNo { get; set; }
public String empName { get; set; }
public String month{ get; set; }
public String org_website { get; set; }
public String org_email { get; set; }
public String org_Address { get; set; }
public String org_Name { get; set; }
//Getter and Setters for Objects
public Organization__c orgs{get;set;}
public SFDC_Employee__c employee{get;set;}
public Employee_Monthly_Info__c eMonthInfo{get;set;}
public string empNumbertoget{get;set;}
//Constructor for the controller
public payslipController()
{
    empNumbertoget= ApexPages.CurrentPage().getParameters().get('eno');
    Date selectedDate =  Date.today();
    Date firstDate = selectedDate.toStartOfMonth();
    Date lastDate = firstDate.addDays(date.daysInMonth(selectedDate.year() , selectedDate.month())  - 1);
    DateTime d = datetime.now();
    month= d.format('MMMMM/yyyy');
    String monthName= d.format('MMMMM');


    List<AggregateResult> sumLrequest=[Select sum(days_off__c) s,Request_Start_Date__c, Request_End_Date__c  from SFDC_PTO_Request__c where   Request_Start_Date__c> :firstDate  and Request_End_Date__c< : lastdate and employee__r.Employee_ID__c=:empNumberToGet group by Request_End_Date__c,Request_Start_Date__c ];


    //Retrieve all the required data from Organization__c,Employee__c,Bank_Account__c,Employee_Monthly_Info__c (custom objects) Using SOQL
    List<Organization__c> org=[select id,name,address__c,Email__c,website__c from Organization__c where name='Waste Ventures India Private Limited'];

    List<SFDC_Employee__c> emp=[select name,Employee_ID__c,Title__c,Pan_Number__c,Start_Date__c,Email_Address__c,Gender__c,Bank_Account_No__c,Bank_Name__c,available_casual_leaves__C,available_sick_leaves__c  FROM SFDC_Employee__c where Employee_ID__c=:empNumbertoget];

    List<Employee_Monthly_Info__c> eInfo=[select Employee_Monthly_Info__c.employee__R.name,Medical_Allowance__c,Total_Salary_Amount__c,Net_Salary__c,Total_Deduction__c,Other_Income__c,Loan_Deduction__c,HRA_AMount__c,pt__c,pf__c,Conveyance_Allowance_Amount__c,TDS__c,paid_holidays__c,Total_Casual_Leaves__c,Total_Sick_Leaves__c,basic_salary__c,Leave_with_Pay__c,working_days__c from Employee_Monthly_Info__c where Employee_Monthly_Info__c.employee__R.Employee_ID__c=:empNumbertoget];

    //Retrieve Organization related data

    if(org.size()==0)
    {
         System.debug('org is '+org);
        ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL, 'Organization details are empty'));
    }

    else
    {
    //Retrieve Organization related data
    orgs=org[0];
    org_Name=orgs.Name;
    org_Address = orgs.Address__c;
    org_email=orgs.email__c;
    org_website=orgs.website__c;

    //Retrieve Employee related data
    employee=emp[0];
    empName = employee.name;
    empNo=employee.Employee_ID__c;
    acleaves=employee.available_casual_leaves__c;
    asleaves=employee.available_sick_leaves__c;
    panNumber =employee.Pan_Number__c;
    Date dat=employee.Start_Date__c;
    doj=String.valueOf(dat);
    designation=employee.Title__c;
    gender=employee.gender__c;
    email=employee.Email_Address__c;
    AccountNumber = employee.Bank_Account_No__c;
    no_days=Date.daysInMonth(d.year(), d.month());

     if(sumLrequest.size() > 0)
    {
       String str = '' + sumLrequest[0].get('s') ;
       lwp= Decimal.ValueOf(str).setScale(0) ;

    }
    if(sumLrequest.size()==null)
    {
       String str = '' + 0;
       lwp= Decimal.ValueOf(str).setScale(0) ;
    }
    //Retrieve Employee monthly Related data
    eMonthInfo=eInfo[0];
   loandeduction =emonthInfo.loan_deduction__c;
    oIncome=eMonthInfo.other_income__c;
    workingDays =eMonthInfo.working_days__c;
   tcleaves=eMonthInfo.total_casual_leaves__c;
    tsleaves=eMonthInfo.total_Sick_leaves__c;
    bSalary=eMonthInfo.basic_salary__c;
    deductions=eMonthInfo.total_deduction__c;
    tsalaryAmount=eMonthInfo.Total_Salary_Amount__c;
    pf=eMonthInfo.pf__c;
    pt=eMonthInfo.pt__c;
    tdeduce=eMonthInfo.total_deduction__c;
    caAmount=eMonthInfo.Conveyance_Allowance_Amount__c;
    hraAmount=eMonthInfo.HRA_Amount__c;
    obAmount=eMonthInfo.Medical_Allowance__c;
    tnetsalary=eMonthInfo.net_salary__c;
    tds=eMonthInfo.tds__c;
    }

}
}
I have an Custom_Object_A__c which has a look up relation with Custom_Object_B__c. 
Custom_Object_A__c has a field NumberS__c (Number(15,0)).
Custom_Object_b__c has a field parentNumber__c((Number(15,0))
When i want to create a new record in Custom_Object_b__c then i need to autopopulate parentNumber__c field with NumberS__c  value. How can i achieve without using URL hack ?
Hi, 

I had three custom fields like available_casual_leaves__c,available_sick_leaves__c and days_off __c on leave_request__c object.
the default values of available_Casual_leaves__c is 20 and available_sick_leaves__c is 10. Now i have to update the default values in both available_casual_leaves__c and available_sick_leaves__c. for that i am writing

trigger availableLeavesTrigger on Leave_Request__c (before Update) {
    List<Leave_Request__c> lr= new List<Leave_Request__c>();
    List< Leave_Request__c> IdsForUpdate = new List< Leave_Request__c>();
    Leave_Request__c lqr=new Leave_Request__c();
    List<leave_request__c> leaveList=new LIST<leave_request__c>();   
    if(trigger.isUpdate)
    {
        for(Leave_Request__c l:trigger.new)
        {
            IdsForUpdate.add(l);
        }       
    }
    for(leave_request__C leave:[Select id,name, type_of_leave__c,Available_casual_leaves__c,
        Available_sick_leaves__c,  days_off__c from Leave_Request__c where id=:IdsForUpdate])
    {
       System.debug('isjfh 0 -- > '+leave);
        if(leave.type_of_leave__C=='casual leave')
        {
            System.debug('0 -- > '+leave);
            leave.available_casual_leaves__c=leave.available_casual_leaves__c-leave.days_off__c;
            System.debug('1 -- > '+leave.available_casual_leaves__c);
            leaveList.add(leave);          
        }
        else if(leave.type_of_leave__c=='sick leave')
        {
            leave.available_sick_leaves__c=leave.available_sick_leaves__c-leave.days_off__c;
            System.debug('2 -- > '+leave.available_sick_leaves__c);
            leaveList.add(leave);
        }
      }
      update leavelist;
  }

but i am not able to see any debug logs and ofcourse the values are not updating could any one tell me where i am going wroing
i have three custom objects.

Bank_Account__c(Parent) --->Bank_transaction__c(child)

Bank_Account__c(Parent) --->Bank_statement__c(child)

Bank_transaction__c fields are date__c, credit__c, debit__c

Bank_statement__c fields are start_date__c, end_date__c

I just want to write a single query to get the records of Bank_transaction__c which date__c is in between start_date__c and end_date__c of bank_statement__c object. How can i achieve this
On the beginning of this month , I scheduled my Dev 401 exam. While i am writing ,In middle of the exam , the exam has been ended saying some error as out of webcam even i am infront of it as per the conditions. I immediatly opened a case and waiting for their reply . And couple of days back i opened another case mentioning the same , but still there is no response. I have my case number. How can i check my case status ? Why does this suspension is done ? what does it mean ? What can i do now ? could any one suggest me
Hello all,

I want to pass the List values of an object to the other Visualforce page using a query. Since we cannot pass list as parameter to other page i am using

public PageReference DisplayDetails() {
      
        PageReference reRend = new PageReference('/apex/wrapperCustomObjpage2');
        reRend.setRedirect(false);
        return reRend;
       
    }

But the variables in the controller were reintializing after entering into the other page. I am not able to display the data into pageblocktable. Could any one suggest me the best approach