• uu
  • NEWBIE
  • 65 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 13
    Replies
Hii Developers,
Please help to write test class for this part of code.
code
Income_Tax__c ITax=[select id,Rent_paid_to_landlord__c,Leave_travel_concessions_or_assistance__c,Employees_PF__c,
                            Interest_payable_paid_to_lender__c,Children_s_Education_Fee__c,PPF__c,Insurance_Premium__c,
                            NSC__c,Deduction_under_Pension_scheme__c,Housing_loan_principal_repayment__c,ELSS_Mutual_Fund__c,
                            NPS__c,Payment_for_Medical_Insurance_Premium__c,Medical_treatment_for_handicapped__c,
                            Medical_for_specified_diseases__c,Education_Loan_Interest_Repayment__c,Interest_on_loan_taken_for_house__c,
                            Donation__c,Rent_deduction_only_if_HRA_not_received__c,Saving_interest__c,Rebate_of_Rs_2000__c,RGESS__c,
                            Royalty__c,Professional_Development_Allowance__c,Car_Maintenance_Allowance__c,
                            Conveyance_Allowance__c,Helper_Allowance__c,Telephone_Internet_allowance__c,
                            Tax_by_previous_employer__c,TDS_already_deducted_by_Current_Company__c,Donation_to_Other__c
                            from Income_Tax__c where id=:tax.id];
        If(ITax.Rent_paid_to_landlord__c!=null){
            Attachment a = new Attachment(parentid=tax.id, Name = 'Rent paid to landlord.jpeg' , Body = myfile.body);
            try {insert a;}
            catch(Exception ex){
                ApexPages.addMessages(ex);
                return null;
            }
        }
        
        If(ITax.Leave_travel_concessions_or_assistance__c!=null){
            Attachment a1 = new Attachment(parentid=tax.id, Name = 'Leave travel concessions or assistance.jpeg', Body = myfile1.body);
            try {insert a1;}
            catch(Exception ex){
                ApexPages.addMessages(ex);
                return null;
            }
        }
        
        If(ITax.Interest_payable_paid_to_lender__c!=null){
            Attachment a2 = new Attachment(parentid=tax.id, Name = 'Interest payable paid to lender.jpeg' , Body = myfile2.body);
            try {insert a2;}
            catch(Exception ex){
                ApexPages.addMessages(ex);
                return null;
            }
        }
        
        If(ITax.Employees_PF__c!=null){
            Attachment a3 = new Attachment(parentid=tax.id, Name = 'Employees Provident Fund.jpeg' , Body = myfile3.body);
            try {insert a3;}
            catch(Exception ex){
                ApexPages.addMessages(ex);
                return null;
            }
        }
        
        If(ITax.Children_s_Education_Fee__c!=null){
            Attachment a4 = new Attachment(parentid=tax.id, Name = 'Children Education Fee.jpeg' , Body = myfile4.body);
            try {insert a4;}
            catch(Exception ex){
                ApexPages.addMessages(ex);
                return null;
            }
        }

Please help me
Thank you.
  • July 29, 2020
  • Like
  • 0
Hello Developers,
I have created one Income Tax form using Vf page
In the Start of the Financial year(in April) customer will fill the information and Amount for different Allowance and Sections.
That record stores in salesforce's custom object Income_Tax__c.

Now i want to display upload document option for that form in End of the Finacial year i.e. in March Month...
How i do it?
Please guide me developers.
Thank you in advance.
  • July 22, 2020
  • Like
  • 0

Hello developers,
I have created one Holiday Calendar using Calendar tab in salesforce.
Now i want to display that Holiday Calendar in VF page how i can do it?
Please suggest me any code.Its urgent!
Thank you 
Regards,
Anita Sodhi

  • June 29, 2020
  • Like
  • 0
Hii developers,
Please guide me how to do this.
I want to calcualate Total leave for employee.
On Employee__c object i have custom fields Join_date__c, Total_Allocated_Leaves__c,Taken_Leaves__c, 
Remain_Leaves__c(Total_Allocated_Leaves__c-Taken_Leaves)

In general total Leaves are 18 Leaves per year
so that for one month it is 1.5 Leave

But if employee has join_date__c=11-june-2020.
then calculates it (1.5*20)/30=1
here 20 is the number of days he worked in june month and 30 is the total days in june month.
so the overall Leaves for the employee is[18-(1.5-1)]=17 Leaves.

after the one year it will updates the Total_Allocated_Leaves__c with 21+Remain_Leaves__c.

Please help me how to do this!
Thank you.

Regards,
Anita Sodhi

 
  • June 22, 2020
  • Like
  • 0
Hello developers,
I need help.
If InputField in not null then enable InputFile apex tag on VF page.
How to do it.
Please help me.
Thanks in advance
Regards,
Anita sodhi
  • June 16, 2020
  • Like
  • 0
Hello Developers,
Please help me to write test class for below apex contoller
public class HRApplyLeaveController {
    Public HRApplyLeaveController(){}
    public String loggesInName{get;set;}
    Public String ResourceName{get;set;}
    public Date FromDate{get;set;}
    
    public List<Leave__c> allLeave{set;get;}
    
    String loggesInId{set;get;}
    List<Resource__c> user = new List<Resource__c>();
    Leave__c lev;
    
    public HRApplyLeaveController(ApexPages.StandardController controller){
        
        ResourceName = System.currentPagereference().getParameters().get('name');
        lev = (Leave__c)controller.getRecord();
        
        user = [SELECT id,Name,Official_Email__c,Personal_Email__c from Resource__c where Name=:ResourceName];
        if(user.size()>0)
        {
            if(user[0].Name != NULL)
            {
                loggesInName =  user[0].Name;
            }
        }
        fetchallLeave();
    }
    //table
    public void fetchallLeave(){
        if(user.size()>0){
            allLeave=[Select From_Date__c,To_Date__c,Type__c,Decision__c,Number_of_Days__c From Leave__c 
                      where Resource__r.Name=:user[0].Name];
        }
    }
    //popup
     public boolean displayPopup {get; set;}
    public void closePopup()
    {       
        displayPopup = false;   
    }    
    public void showPopup()
    {       
        displayPopup = true;
        save();   
    }
    //insert record
    public Pagereference save(){
        lev.Resource__c=user[0].id;
        try{
            insert lev;
            ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'Thank you!Record saved successfully'));
            
        }
        catch(Exception ex){
            ApexPages.addMessages(ex);
        }
        
        //send email
        Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
        email.setSubject('Leave Application |'+user[0].Name);
        
        email.setToAddresses( new List<String>{user[0].Personal_Email__c} );
        email.setHtmlBody('Hii Sir/Mam,<br/><br/>https://login.my.salesforce.com/'+lev.Id+
                          '<br/><br/>Regards,<br/>'+'User');
        try{
            Messaging.SendEmailResult [] result = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
        }catch(System.Exception e){
            system.debug(e);
        }
        return null;
    }
    //home button
    public Pagereference goHome(){
        PageReference pageRef = new PageReference('/apex/HRHome?id='+user[0].id);
        pageRef.setRedirect(true);
        return pageRef;
    }
}

Test class
@isTest
public class HRApplyLeaveControllerTest {
    static testMethod void Test_HRApplyLeaveController() 
    {
        Resource__c res= new Resource__c(Name='Swapnil Joshi',Official_Email__c='abc@xyz.com', Password__c='s123',Emp_ID__c=1);
        insert res;
        
        Leave__c l=new Leave__c();
        l.Resource__c=res.id;
        l.From_Date__c=system.today();
        l.To_Date__c=system.today()+5;
        insert l;
    }
}

Thanks in advance.. :)
Regards,
Anita sodhi
  • June 08, 2020
  • Like
  • 0
Hello Friends,
Please help me!
I have custom field Zip_Code__c(Number field)
After inserting any value it display 123,456(with comma)
How i convert the Number entered into Zip_code__c into Text Field.
so it will display like 123456(without comma).
Thank you!

Regards
Anita
  • May 29, 2020
  • Like
  • 0
Hey Friends,
Please help me to write test class for following apex class.
global class sendPDFEmailClass{
    public sendPDFEmailClass(){}
        public sendPDFEmailClass(ApexPages.StandardController controller) {
    }
    
    webservice static void SendEmail(){
        Id recordId=ApexPages.currentPage().getParameters().get('Id');
        Monthly_Salary__c inv = [Select Id, Name ,Resource__c From Monthly_Salary__c Where Id=:recordId];
        Id ResourceID=inv.Resource__c;
        Resource__c res=[select id, Name, Official_Email__c,Personal_Email__c from Resource__c where id=:ResourceID];
        PageReference pdf = Page.SalarySlipPage;
        pdf.getParameters().put('id', recordId);
        pdf.setRedirect(true);
        system.debug(pdf.getContentAsPDF());
        Blob b;
        
        if (Test.IsRunningTest()){
            b=Blob.valueOf('this is test');
        }else{
            b = pdf.getContentAsPDF();
        }
        // Create Attachment Object to attach with Email
        Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
        efa.setFileName(inv.Name+'.pdf');
        efa.setBody(b);
        // Define the email
        Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
        // Sets the paramaters of the email
        email.setSubject('Salary Slip - '+inv.Name);
        if(res.Personal_Email__c!=Null){
            email.setCCAddresses( new List<String>{res.Personal_Email__c} );}
        if(res.Official_Email__c==Null){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.WARNING,'The Resource has no Official email Address.'));
        }
        else{
            email.setToAddresses( new List<String>{res.Official_Email__c} );
        }
        email.setHtmlBody('Hi '+res.Name+',<br/><br/> '+'Please find attached your salary slip for the month of '+inv.Name+
                          +'<br/><br/>'+'Thank You,'+'<br/>'
                          +'Anita');
        email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
        try{
            Messaging.SendEmailResult [] result = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
        }catch(System.Exception e){
            
        }
    }
}

Below is the test class
@IsTest
public class sendPDFEmailClassTest {
    
        @IsTest public static void SendemailControllerTestClass() {
        Resource__c res=new Resource__c();
        res.Name='TestR';
        res.Company__c='Nanostuffs';
        res.Official_Email__c='akshata.shah@nanostuffs.com';
        res.Personal_Email__c='test@gmail.com';
        insert res;
        
        Monthly_Salary__c m=new Monthly_Salary__c();
        m.Resource__c=res.Id;
        m.From_Date__c=date.newInstance(2020, 11,1);
        m.To_Date__c=date.newInstance(2020, 11, 30);
        
        insert m;
        
    }
}

I m not getting how to write test class for SingleEmailMessage
Please help me
Thank in advance
Regards,
Anita
  • May 19, 2020
  • Like
  • 0
Hey Folks,
Plese help me to write trigger.
I have 3 custom object 
Employee__c, Leaves__c ,Month__c.
On Leaves__c has Lookup with Employee__c and 1 date field Leave_Date__c.
And On Month__c Master-datail with Employee__c and 1 Leaves_Taken__c number field.

After inserting new Leave__c for that Employee__c It will increment the value by 1 of custom field Leaves_Taken__c  for that Month in Month__c object.

If delete the Leaves then decrement the value by 1.

Like Example in below
In Month__c obj, we now have a record for each Month for that Employee. So if leave was approved & taken on 10th Jan 2020, then increment the "Leaves Taken" count on Jan 2020 record in Month__c by 1. On insert, increment to happen. On Delete, decrement to happen. On update, both decrement for old value of Leave Date in Month__c  obj & increment of new value in respective records.

Please me out to write trigger for it.
Thanks in advance 

Regards,
Anita Sodhi
  • May 04, 2020
  • Like
  • 0
Hii Friends,'
When i was doing additon of two cutsom Field of type "Time" in formula field of type "Time".
X1__c  +  X2__c 
It shows error like
Error: Incorrect argument type for operator '+'.

Please Help me
Thank you
  • April 16, 2020
  • Like
  • 0
Hey friends,
I want to set default value as 9 to "Time" Field.
09:00:00
09
09:00
Above values not accepting.
Please tell me how to write it.
Thank you
  • April 15, 2020
  • Like
  • 0
I have custom object with a field Geolocation type .
How can i create map view of that cities .
I have inserted longitude and latitude values for every city.
how i add it to page layout?
  • April 12, 2020
  • Like
  • 0
Hii Friends,
Please help me.
The below javascript code on custom detail page button  shows error on click it.
--------------------------------------------------------------------------------------
{!REQUIRESCRIPT("/soap/ajax/47.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/47.0/apex.js")} 

var tempID='{!Offers_Appraisals__c.Id}';
if({!Offers_Appraisals__c.Id}!=Null)
{
sforce.apex.execute("NanoHRSheet","HRSalarySheet",tempID);
}
--------------------------------------------------------------------------------------
Error:
User-added image

What's wrong with code?
Please help me.
Thank you
  • April 10, 2020
  • Like
  • 0
Hello Guys,

I want to check whether the records is already exist if yes then update it with new data if not insert new record into custom field.


currentRecord = [SELECT ID,Base_Yearly_Package__c FROM  Offers_Appraisals__c WHERE Id = :'a12M000000MMF6k'];

    List<Monthly_Salary__c> SalList = new List<Monthly_Salary__c>();
    SalList=[SELECT ID,Name,From_Date__c FROM Monthly_Salary__c WHERE Resource__c=:currentRecord.Resource__c];
    
                Monthly_Salary__c new_records2=new Monthly_Salary__c();
                                new_records2.Base_Yearly_Package__c=currentRecord.Base_Yearly_Package__c;
                                new_records2.Resource__c=currentRecord.Resource__c;

    for(Monthly_Salary__c s:SalList){
                                        if(s.Name!=new_records3.Name) {
                                            insert new_records3;
                                            break;
                                        } else {update new_records3;}
                           }


Above code working.Not even inserting nor updating the records.
Please help me.
where i am wrong?
Thank you
  • April 10, 2020
  • Like
  • 0
Hii Guys,
Please help me! I am new to apex code.
I want to access the current Record ID.
and assign that ID to another variable in apex class.

 
public class SampleCode{
    Public Offers_Appraisals__c currentRecord{get; set;}
 
        public SampleCode(ApexPages.StandardController controller) {
        currentRecord = [SELECT ID FROM Offers_Appraisals__c
                                               WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
        } 

public static void HRSalarySheet()
    {
        List<Offers_Appraisals__c> OfferList=new List<Offers_Appraisals__c>();
        OfferList=[SELECT ID,Name,
                                              From_Date__c,To_date__c
                                              FROM Offers_Appraisals__c
                                             WHERE ID=:currentRecord.ID];
    }


When i use the above code  it shows error msg 
Variable Does not exist currentRecod.
Please Help me to solve error.
Where my code is going wrong?

Thanks you
  • April 09, 2020
  • Like
  • 0
Hello 
Please help me out
I have 3 custom object Employee, Payment & Proposal.
Payment have lookup with Employee.
Proposal have lookup with Employee.
Proposal has Year_package__c & From_Date__c custom fileds.

I want to create a custom button(Create Payments) on Proposal detail page.
On click of Create_Payements__c button it will create 12 new record on Payment (Custom obj.) for that Employee.
On Payement The 12 record will be Name like Jan 2020,Feb2020 and so on(as per From_Date__c on Proposal object).
How do I code for it on Custom button??????

Thanks in advance
  • April 08, 2020
  • Like
  • 0
Hii Developers,
Please help to write test class for this part of code.
code
Income_Tax__c ITax=[select id,Rent_paid_to_landlord__c,Leave_travel_concessions_or_assistance__c,Employees_PF__c,
                            Interest_payable_paid_to_lender__c,Children_s_Education_Fee__c,PPF__c,Insurance_Premium__c,
                            NSC__c,Deduction_under_Pension_scheme__c,Housing_loan_principal_repayment__c,ELSS_Mutual_Fund__c,
                            NPS__c,Payment_for_Medical_Insurance_Premium__c,Medical_treatment_for_handicapped__c,
                            Medical_for_specified_diseases__c,Education_Loan_Interest_Repayment__c,Interest_on_loan_taken_for_house__c,
                            Donation__c,Rent_deduction_only_if_HRA_not_received__c,Saving_interest__c,Rebate_of_Rs_2000__c,RGESS__c,
                            Royalty__c,Professional_Development_Allowance__c,Car_Maintenance_Allowance__c,
                            Conveyance_Allowance__c,Helper_Allowance__c,Telephone_Internet_allowance__c,
                            Tax_by_previous_employer__c,TDS_already_deducted_by_Current_Company__c,Donation_to_Other__c
                            from Income_Tax__c where id=:tax.id];
        If(ITax.Rent_paid_to_landlord__c!=null){
            Attachment a = new Attachment(parentid=tax.id, Name = 'Rent paid to landlord.jpeg' , Body = myfile.body);
            try {insert a;}
            catch(Exception ex){
                ApexPages.addMessages(ex);
                return null;
            }
        }
        
        If(ITax.Leave_travel_concessions_or_assistance__c!=null){
            Attachment a1 = new Attachment(parentid=tax.id, Name = 'Leave travel concessions or assistance.jpeg', Body = myfile1.body);
            try {insert a1;}
            catch(Exception ex){
                ApexPages.addMessages(ex);
                return null;
            }
        }
        
        If(ITax.Interest_payable_paid_to_lender__c!=null){
            Attachment a2 = new Attachment(parentid=tax.id, Name = 'Interest payable paid to lender.jpeg' , Body = myfile2.body);
            try {insert a2;}
            catch(Exception ex){
                ApexPages.addMessages(ex);
                return null;
            }
        }
        
        If(ITax.Employees_PF__c!=null){
            Attachment a3 = new Attachment(parentid=tax.id, Name = 'Employees Provident Fund.jpeg' , Body = myfile3.body);
            try {insert a3;}
            catch(Exception ex){
                ApexPages.addMessages(ex);
                return null;
            }
        }
        
        If(ITax.Children_s_Education_Fee__c!=null){
            Attachment a4 = new Attachment(parentid=tax.id, Name = 'Children Education Fee.jpeg' , Body = myfile4.body);
            try {insert a4;}
            catch(Exception ex){
                ApexPages.addMessages(ex);
                return null;
            }
        }

Please help me
Thank you.
  • July 29, 2020
  • Like
  • 0
Hello Developers,
Please help me to write test class for below apex contoller
public class HRApplyLeaveController {
    Public HRApplyLeaveController(){}
    public String loggesInName{get;set;}
    Public String ResourceName{get;set;}
    public Date FromDate{get;set;}
    
    public List<Leave__c> allLeave{set;get;}
    
    String loggesInId{set;get;}
    List<Resource__c> user = new List<Resource__c>();
    Leave__c lev;
    
    public HRApplyLeaveController(ApexPages.StandardController controller){
        
        ResourceName = System.currentPagereference().getParameters().get('name');
        lev = (Leave__c)controller.getRecord();
        
        user = [SELECT id,Name,Official_Email__c,Personal_Email__c from Resource__c where Name=:ResourceName];
        if(user.size()>0)
        {
            if(user[0].Name != NULL)
            {
                loggesInName =  user[0].Name;
            }
        }
        fetchallLeave();
    }
    //table
    public void fetchallLeave(){
        if(user.size()>0){
            allLeave=[Select From_Date__c,To_Date__c,Type__c,Decision__c,Number_of_Days__c From Leave__c 
                      where Resource__r.Name=:user[0].Name];
        }
    }
    //popup
     public boolean displayPopup {get; set;}
    public void closePopup()
    {       
        displayPopup = false;   
    }    
    public void showPopup()
    {       
        displayPopup = true;
        save();   
    }
    //insert record
    public Pagereference save(){
        lev.Resource__c=user[0].id;
        try{
            insert lev;
            ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'Thank you!Record saved successfully'));
            
        }
        catch(Exception ex){
            ApexPages.addMessages(ex);
        }
        
        //send email
        Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
        email.setSubject('Leave Application |'+user[0].Name);
        
        email.setToAddresses( new List<String>{user[0].Personal_Email__c} );
        email.setHtmlBody('Hii Sir/Mam,<br/><br/>https://login.my.salesforce.com/'+lev.Id+
                          '<br/><br/>Regards,<br/>'+'User');
        try{
            Messaging.SendEmailResult [] result = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
        }catch(System.Exception e){
            system.debug(e);
        }
        return null;
    }
    //home button
    public Pagereference goHome(){
        PageReference pageRef = new PageReference('/apex/HRHome?id='+user[0].id);
        pageRef.setRedirect(true);
        return pageRef;
    }
}

Test class
@isTest
public class HRApplyLeaveControllerTest {
    static testMethod void Test_HRApplyLeaveController() 
    {
        Resource__c res= new Resource__c(Name='Swapnil Joshi',Official_Email__c='abc@xyz.com', Password__c='s123',Emp_ID__c=1);
        insert res;
        
        Leave__c l=new Leave__c();
        l.Resource__c=res.id;
        l.From_Date__c=system.today();
        l.To_Date__c=system.today()+5;
        insert l;
    }
}

Thanks in advance.. :)
Regards,
Anita sodhi
  • June 08, 2020
  • Like
  • 0
Hello Friends,
Please help me!
I have custom field Zip_Code__c(Number field)
After inserting any value it display 123,456(with comma)
How i convert the Number entered into Zip_code__c into Text Field.
so it will display like 123456(without comma).
Thank you!

Regards
Anita
  • May 29, 2020
  • Like
  • 0
Hii Friends,'
When i was doing additon of two cutsom Field of type "Time" in formula field of type "Time".
X1__c  +  X2__c 
It shows error like
Error: Incorrect argument type for operator '+'.

Please Help me
Thank you
  • April 16, 2020
  • Like
  • 0
Hey friends,
I want to set default value as 9 to "Time" Field.
09:00:00
09
09:00
Above values not accepting.
Please tell me how to write it.
Thank you
  • April 15, 2020
  • Like
  • 0
I have custom object with a field Geolocation type .
How can i create map view of that cities .
I have inserted longitude and latitude values for every city.
how i add it to page layout?
  • April 12, 2020
  • Like
  • 0
Hii Friends,
Please help me.
The below javascript code on custom detail page button  shows error on click it.
--------------------------------------------------------------------------------------
{!REQUIRESCRIPT("/soap/ajax/47.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/47.0/apex.js")} 

var tempID='{!Offers_Appraisals__c.Id}';
if({!Offers_Appraisals__c.Id}!=Null)
{
sforce.apex.execute("NanoHRSheet","HRSalarySheet",tempID);
}
--------------------------------------------------------------------------------------
Error:
User-added image

What's wrong with code?
Please help me.
Thank you
  • April 10, 2020
  • Like
  • 0
Hello Guys,

I want to check whether the records is already exist if yes then update it with new data if not insert new record into custom field.


currentRecord = [SELECT ID,Base_Yearly_Package__c FROM  Offers_Appraisals__c WHERE Id = :'a12M000000MMF6k'];

    List<Monthly_Salary__c> SalList = new List<Monthly_Salary__c>();
    SalList=[SELECT ID,Name,From_Date__c FROM Monthly_Salary__c WHERE Resource__c=:currentRecord.Resource__c];
    
                Monthly_Salary__c new_records2=new Monthly_Salary__c();
                                new_records2.Base_Yearly_Package__c=currentRecord.Base_Yearly_Package__c;
                                new_records2.Resource__c=currentRecord.Resource__c;

    for(Monthly_Salary__c s:SalList){
                                        if(s.Name!=new_records3.Name) {
                                            insert new_records3;
                                            break;
                                        } else {update new_records3;}
                           }


Above code working.Not even inserting nor updating the records.
Please help me.
where i am wrong?
Thank you
  • April 10, 2020
  • Like
  • 0
Hii Guys,
Please help me! I am new to apex code.
I want to access the current Record ID.
and assign that ID to another variable in apex class.

 
public class SampleCode{
    Public Offers_Appraisals__c currentRecord{get; set;}
 
        public SampleCode(ApexPages.StandardController controller) {
        currentRecord = [SELECT ID FROM Offers_Appraisals__c
                                               WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
        } 

public static void HRSalarySheet()
    {
        List<Offers_Appraisals__c> OfferList=new List<Offers_Appraisals__c>();
        OfferList=[SELECT ID,Name,
                                              From_Date__c,To_date__c
                                              FROM Offers_Appraisals__c
                                             WHERE ID=:currentRecord.ID];
    }


When i use the above code  it shows error msg 
Variable Does not exist currentRecod.
Please Help me to solve error.
Where my code is going wrong?

Thanks you
  • April 09, 2020
  • Like
  • 0
Hello 
Please help me out
I have 3 custom object Employee, Payment & Proposal.
Payment have lookup with Employee.
Proposal have lookup with Employee.
Proposal has Year_package__c & From_Date__c custom fileds.

I want to create a custom button(Create Payments) on Proposal detail page.
On click of Create_Payements__c button it will create 12 new record on Payment (Custom obj.) for that Employee.
On Payement The 12 record will be Name like Jan 2020,Feb2020 and so on(as per From_Date__c on Proposal object).
How do I code for it on Custom button??????

Thanks in advance
  • April 08, 2020
  • Like
  • 0
Hi guys, the quote template has lots of limitations when it comes to styling; I would like to do something custom and need a step-by-step guide. Basically, I would like a "create quote" button on quote pagelayout that references my visualforce page and creates the pdf. 

So I think I need to follow the steps below:
1. Create a custom controller class. Can I do this with standard List controller? Basically, I have to query all the quote and quotelineitems
2. Create a new visual force page using controller from step1, add the proper styling and render as pdf.
3. Create the button on quote with a link to visual force page
Any tips and guides are appreciated. 
Thanks.

Did I miss anything? 
 
  • October 17, 2016
  • Like
  • 0
Hi All

I am currently working on an implementation of a calendar view in a Visualforce page. Basic idea is to display a schedule on the calendar based on date fields in custom objects. From some searching, I came across this article: http://www.codebycody.com/2013/06/create-calendar-view-in-salesforcecom.html

I tried to follow the code in the working example, but the calendar does not display in the page. Below is the screenshot of the page: 
User-added image

Glady appreciate if someone can guide me through this issue and how best to implement this feature.