• udayarangareddy mekala
  • NEWBIE
  • 299 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 101
    Questions
  • 67
    Replies
Hi

How to create the Custom Report(Through VisualForce Page)



Regards
Rangareddy
 

VF PAGE

-----------
<apex:page standardController="Empolyee_Details__c" extensions="EmployeeRelatedList" tabStyle="Empolyee_Details__c">
  <apex:form >
    <apex:sectionHeader title="EmployeeInfo"/>
    <apex:pageBlock title="EmployeeData">

       

        <apex:pageBlockSection title="Empolyee basic Details" columns="2" collapsible="false">

              <apex:outputField value="{!Empolyee_Details__c.EmpId__c}"/>
            <apex:inputField value="{!Empolyee_Details__c.FirstName__c}"/>

            <apex:inputField value="{!Empolyee_Details__c.LastName__c}"/>
             <apex:inputField value="{!Empolyee_Details__c.MiddleName__c}"/>

            <apex:inputField value="{!Empolyee_Details__c.DateofBirth__c}"/>
             <apex:inputField value="{!Empolyee_Details__c.FatherMotherhusbandName__c}"/>

            <apex:inputField value="{!Empolyee_Details__c.MartialStatus__c}"/>

        </apex:pageBlockSection>

        <apex:pageBlockSection title="Empolyee office Details" columns="2" collapsible="false">

            <apex:inputField value="{!Empolyee_Details__c.Current_Designation__c}"/>

            <apex:inputField value="{!Empolyee_Details__c.Current_Office__c}"/>
            
            <apex:inputField value="{!Empolyee_Details__c.Current_Cadre__c}"/>

        </apex:pageBlockSection>
      
      <apex:pageBlockSection title="Present Address Detail" columns="2" collapsible="false">
      
      <apex:inputField value="{!Empolyee_Details__c.Present_Address__c}"/>
       <apex:inputField value="{!Empolyee_Details__c.State__c}"/>
       <apex:inputField value="{!Empolyee_Details__c.District__c}"/>
        <apex:inputField value="{!Empolyee_Details__c.Phone_Number__c}"/>
         <apex:inputField value="{!Empolyee_Details__c.Mobile_Number__c}"/>
          <apex:inputField value="{!Empolyee_Details__c.Pin_Code__c}"/>
          <apex:inputField value="{!Empolyee_Details__c.E_mail_if_any__c}"/>
          
      </apex:pageBlockSection>  

          <apex:pageBlockSection title="Perment Address Detail" columns="2" collapsible="false">
              <apex:inputField value="{!Empolyee_Details__c.Permanent_Address__c}"/>
              <apex:inputField value="{!Empolyee_Details__c.State_p__c}"/>
              <apex:inputField value="{!Empolyee_Details__c.District_p__c}"/>
              <apex:inputField value="{!Empolyee_Details__c.Pin_Code_p__c}"/>
              <apex:inputField value="{!Empolyee_Details__c.Phone_Number_p__c}"/>
              <apex:inputField value="{!Empolyee_Details__c.Mobile_Number_p__c}"/>
              
   </apex:pageBlockSection>
           <apex:pageblockSection title="Joing Details" collapsible="false">
               <apex:inputField value="{!Empolyee_Details__c.Date_of_Joining__c}"/>
               <apex:inputField value="{!Empolyee_Details__c.Date_of_Leaving__c}"/>
      </apex:pageblockSection>
        <apex:pageBlockSection title="Basic" collapsible="false">
           <apex:inputField value="{!Empolyee_Details__c.Education__c}"/>
            <apex:inputField value="{!Empolyee_Details__c.Name_of_Board_University__c}"/>
             <apex:inputField value="{!Empolyee_Details__c.Marks_Obtained_In__c}"/>
             <apex:inputField value="{!Empolyee_Details__c.Passing_Year__c}"/>
             <apex:inputField value="{!Empolyee_Details__c.Stream__c}"/>
              <apex:inputField value="{!Empolyee_Details__c.Grade__c}"/>
            
         </apex:pageBlockSection>
        

            
<apex:inputFile filename="{!fileName}"   value="{!resume}"/>
  <apex:image url="{!imageURL}"/>
              

          <apex:pageBlockButtons >
            <apex:commandButton action="{!save}" value="SAVE"/>
        </apex:pageBlockButtons>

      

    </apex:pageBlock>
Controller
--------------
public class EmployeeRelatedList {
 private Empolyee_Details__c empDetail;
  public blob picture{get;set;}
 public Blob resume {get; set;}
 public String fileName {get; set;}
 public string imageURL{get; set;}

 
 
    public EmployeeRelatedList(ApexPages.StandardController stdController) {
     
        this.empDetail = (Empolyee_Details__c)stdController.getRecord();
   
 
    }
    
    
  public EmployeeRelatedList(){
       imageURL='/servlet/servlet.FileDownload?file=';
       List< document > documentList=[select name from document where
Name='picture'];
if(documentList.size()>0)
{
imageURL=imageURL+documentList[0].id;
}

 
 
  }
    
    public Pagereference save(){
       

       
        try{



        
        
           
                   
               
            upsert empDetail;
            return new Pagereference('/apex/Custom_pagenations');
            }
            
          

        
        catch(Exception e){
            Apexpages.addMessage(new Apexpages.Message(Apexpages.Severity.ERROR, e.getMessage()));
            return null;
        }
        
     
     
     
   
    }
    
}
For above VF PAGE and CONTROLLER ie the employee registration form.for that i want to upload the image. can u please tell the code for the how to upload the image.





Regards
Rangareddy

 

HI
  How to write the testclass for below triggercode
trigger jobname on job_c (Before Update, After insert,After update,Before delete) {
    list<Job_History_c> jb1 = new list<Job_History__c>();
    list<Job_Notes__c> jn = new list<Job_Notes__c>();
    list<User> listuser =[SELECT Name,Id FROM User];
    map<string,string> namevals = new  map<string,string>();
         for(User u : listuser){
              namevals.put(u.Id,u.Name);
         }
             for below if statement how to compare the oldvalue of the JOB_c to the new value of the JOB_c and how to    insert the job_History_c 
                if(newvals.Name!= oldvals.Name){
                    job_History__c jb = new job_History__c();
                         jb.Field__c = 'Name';
                         jb.New_Value__c= newvals.Name;
                         jb.Old_Value__c= oldvals.Name;
                         jb.jobId__c= newvals.id;
                         jb1.add(jb);
                         }
               insert jb1;        
                         }

Thanks in advance

 
Hi
Please tell me how to compare the oldvalue fields to the newvalue fields in the trigger testclass


Thanks
rangareddy
Hi
how to cover the below trigger code for testclass

        for(Account newvals : Trigger.new){
         
                for(Account oldvals : trigger.old){

                list<Account>acc1 = new <Account>();
                        Account acc = new Account();                              
                        acc.Field__c = 'priority';                              
                       acc.New_Value__c= newvals.priority;                              
                      acc.Old_Value__c= oldvals.Priority;                                                           
                  acc1.add(acc);
}
  }

Thanks&Regards
Ranga
 
For this code how to do the code coverage
        if(cscount==1){
case=[SELECT ID,Assigned_To__c,Tier_Level__c,Notes_c FROM CASE WHERE ID=:csid];         
            case1.Notes__c='';
            if(case1.Assigned_To__c != null)
obj = [SELECT ID,Name from user where id=: case1.Assigned_To__c];

Thanks&Regards
Rangareddy
}





 
Hi
how to pass the test data for the IF conditions
try{
 if(val.contains('null')){
             val=null;
            }  
            }catch(NullPointerException E){
            }
            if(sr!=null&&val!=null){
           system.debug('***before executing doSearch***');
              doSearch();
}
For  above block please guide me how to pass the data depend on If condition.

Thanks&Regards
Rangareddy
HI
  How to cover the IF condition and FOR loop in the TRIGGER TEST Class.I posted below code.

if(Trigger.isInsert){
        for(Account t: Trigger.new){
         Account_History__c acc1 = new Account_History__c();
               acc1.field__c='Creat';
               acc1.accId__c=t.id;

                  acc.add(tacc1);
                  Thanks&Regards
RangaReddy
 

Hi
 if(newvals.severity != oldvals.Serverity){
                    Account acc = new Account();
                         acc.Field__c = 'Severity';
                         acc.New_Value__c= newvals.Severity;
                         acc.Old_Value__c= oldvals.Severity;
                         acc.Id__c = newvals.id;
                         ac.add(acc);

For above code how to write the test class.
Thnks&Regards
rangareddy
 
Hi
if(Check.Me)
    {
        for(Account acc: Trigger.new)
        {
            for(Acount acc1: Trigger.old)
            {
                //   if(acc.Type=='Permenant'||acc.Type=='Current'||acc.Type=='salary'){
                if(tslold.Id == acc.ID)
                {
                    if(acc.Type=='Permenant'||acc.Type=='Current')
                    {
}
How to cover test class for the above triggeer.tll me.

Thanks&Regards
Ranga
}
}
  }
}
HI
How to cover the soql query in the testclass.There is a SOQL query ,FOReach loop after that every record add to the map variable
map<string,string> vals = new  map<string,string>();
list<Account> list =[SELECT Name,Id FROM Account];
for(contact ct : list){
          vals.put(u.Id,u.Name);
     } 
The above one is the trigger code.please give me the solution how to cover that code in test classe.

Thanks&Regards
Rangareddy
HI
I got the error in the Trigger Test Class.The error is Selected job is not yet complete in Apex Test Execution.


Thanks&Regards
Ranga

 
HI
  How to remove the left navigation in the user profile.


Thanks&Regards
RangaReddy


Hi
VFPAGE
<apex:inputFile filename="{!fileName}"   value="{!resume}"/>
CONTROLLER
public String fileName {get; set;}
public Blob resume {get; set;}
 private Empolyee_Details__c empDetail;

  try{
        if(resume!=null){
        Attachment attach=new Attachment();
        attach.Body=resume;
        attach.Name=filename;
        attach.ParentID=empDetail.id;
        upsert(attach);
        
        
        }
           The above one is the FILE ATTATCHMENT CODE .In that code i didnt get any errors but file was not uploading .please tell me any issues are there for above code.

Thansk&Regards
RangaReddy

CONTROLLER
public class EmployeeRelatedList {
 private Empolyee_Details__c empDetail;
public Transient Blob fileBody {get;set;}
 public String fileName {get;set;}
 publlic string ID{get; set;}
  
    public EmployeeRelatedList(ApexPages.StandardController stdController) {
     
        this.empDetail = (Empolyee_Details__c)stdController.getRecord();
   
 
    }
    
    public Pagereference save() {
       

        try{
           if(fileBody !=null && fileName !=null)
                {
                    Attachment myAttachment = new Attachment();
                    myAttachment.Body = fileBody;
                    myAttachment.Name = fileName;
                    myAttachment.ParentId = at.Id;
            }
                   
               
            upsert empDetail;
            return new Pagereference('/apex/Custom_pagenations');
          

        }
        catch(Exception e){
            Apexpages.addMessage(new Apexpages.Message(Apexpages.Severity.ERROR, e.getMessage()));
            return null;
        }
    }
}

VF PAGE

<apex:page standardController="Empolyee_Details__c" extensions="EmployeeRelatedList" tabStyle="Empolyee_Details__c">
  <apex:form >
    <apex:sectionHeader title="EmployeeInfo"/>
    <apex:pageBlock title="EmployeeData">

       

        <apex:pageBlockSection title="Empolyee basic Details" columns="2" collapsible="false">

              <apex:outputField value="{!Empolyee_Details__c.EmpId__c}"/>
            <apex:inputField value="{!Empolyee_Details__c.FirstName__c}"/>

            <apex:inputField value="{!Empolyee_Details__c.LastName__c}"/>
             <apex:inputField value="{!Empolyee_Details__c.MiddleName__c}"/>

            <apex:inputField value="{!Empolyee_Details__c.DateofBirth__c}"/>
             <apex:inputField value="{!Empolyee_Details__c.FatherMotherhusbandName__c}"/>

            <apex:inputField value="{!Empolyee_Details__c.MartialStatus__c}"/>

        </apex:pageBlockSection>

        <apex:pageBlockSection title="Empolyee office Details" columns="2" collapsible="false">

            <apex:inputField value="{!Empolyee_Details__c.Current_Designation__c}"/>

            <apex:inputField value="{!Empolyee_Details__c.Current_Office__c}"/>
            
            <apex:inputField value="{!Empolyee_Details__c.Current_Cadre__c}"/>

        </apex:pageBlockSection>
      
      <apex:pageBlockSection title="Present Address Detail" columns="2" collapsible="false">
      
      <apex:inputField value="{!Empolyee_Details__c.Present_Address__c}"/>
       <apex:inputField value="{!Empolyee_Details__c.State__c}"/>
       <apex:inputField value="{!Empolyee_Details__c.District__c}"/>
        <apex:inputField value="{!Empolyee_Details__c.Phone_Number__c}"/>
         <apex:inputField value="{!Empolyee_Details__c.Mobile_Number__c}"/>
          <apex:inputField value="{!Empolyee_Details__c.Pin_Code__c}"/>
          <apex:inputField value="{!Empolyee_Details__c.E_mail_if_any__c}"/>
          
      </apex:pageBlockSection>  

          <apex:pageBlockSection title="Perment Address Detail" columns="2" collapsible="false">
              <apex:inputField value="{!Empolyee_Details__c.Permanent_Address__c}"/>
              <apex:inputField value="{!Empolyee_Details__c.State_p__c}"/>
              <apex:inputField value="{!Empolyee_Details__c.District_p__c}"/>
              <apex:inputField value="{!Empolyee_Details__c.Pin_Code_p__c}"/>
              <apex:inputField value="{!Empolyee_Details__c.Phone_Number_p__c}"/>
              <apex:inputField value="{!Empolyee_Details__c.Mobile_Number_p__c}"/>
              
   </apex:pageBlockSection>
           <apex:pageblockSection title="Joing Details" collapsible="false">
               <apex:inputField value="{!Empolyee_Details__c.Date_of_Joining__c}"/>
               <apex:inputField value="{!Empolyee_Details__c.Date_of_Leaving__c}"/>
      </apex:pageblockSection>
        <apex:pageBlockSection title="Basic" collapsible="false">
           <apex:inputField value="{!Empolyee_Details__c.Education__c}"/>
            <apex:inputField value="{!Empolyee_Details__c.Name_of_Board_University__c}"/>
             <apex:inputField value="{!Empolyee_Details__c.Marks_Obtained_In__c}"/>
             <apex:inputField value="{!Empolyee_Details__c.Passing_Year__c}"/>
             <apex:inputField value="{!Empolyee_Details__c.Stream__c}"/>
              <apex:inputField value="{!Empolyee_Details__c.Grade__c}"/>
            
         </apex:pageBlockSection>
        <apex:outputLabel value="File" for="file"/>
        
     <apex:pageBlockSectionItem >
           Attachment <apex:inputFile id="fileSize" value="{!fileBody}" filename="{!fileName}" />
        </apex:pageBlockSectionItem>
            

              

          <apex:pageBlockButtons >
            <apex:commandButton action="{!save}" value="SAVE"/>
        </apex:pageBlockButtons>

        <apex:inputfile value="{!Empolyee_Details__c.id}"></apex:inputfile>

    </apex:pageBlock>
     </apex:form>

</apex:page>
Hi
For above code i got errors.The above code is for EMPLOYEE CREATE PAGE.In that i add one more ATTATCHMENT File .i got errors while uploading the file.please slove the issue.


Thanks&Regards
RangaReddy
 

 

 

Hi
  How to make the FIELD as READONLY in EDIT VF PAGE

 

 

 

THANKS&REGARDS

RANGA

Hi
what is the meaning of EDIT SCREEN(Read Only Mode)



Thanks&Regards
Ranga

Hi,
 How to get the DEFAULT NAMES after saving the record.


Thanks

Ranga

Hi,
I created one Custom VF PAGE,in that ATTATCHMENT tab  was created on that page. Under ATTATCHMENT tab i created NEWATTATCHMENT
to upload the new file, under that i created two fields .whenever i uploaded the file default onefield value it was coming but another field default namer was not coming.how to get another field default name.

Thanks&Regards
Ranga
Hi
  What is the difference between <apex:pageblock buttons> and <apex:commandbuttons> in salesforce.


Thanks&Regards
Ranga
Hi

How to create the Custom Report(Through VisualForce Page)



Regards
Rangareddy
 
Hi
how to pass the test data for the IF conditions
try{
 if(val.contains('null')){
             val=null;
            }  
            }catch(NullPointerException E){
            }
            if(sr!=null&&val!=null){
           system.debug('***before executing doSearch***');
              doSearch();
}
For  above block please guide me how to pass the data depend on If condition.

Thanks&Regards
Rangareddy
HI
How to cover the soql query in the testclass.There is a SOQL query ,FOReach loop after that every record add to the map variable
map<string,string> vals = new  map<string,string>();
list<Account> list =[SELECT Name,Id FROM Account];
for(contact ct : list){
          vals.put(u.Id,u.Name);
     } 
The above one is the trigger code.please give me the solution how to cover that code in test classe.

Thanks&Regards
Rangareddy
HI
  How to remove the left navigation in the user profile.


Thanks&Regards
RangaReddy


Hi
VFPAGE
<apex:inputFile filename="{!fileName}"   value="{!resume}"/>
CONTROLLER
public String fileName {get; set;}
public Blob resume {get; set;}
 private Empolyee_Details__c empDetail;

  try{
        if(resume!=null){
        Attachment attach=new Attachment();
        attach.Body=resume;
        attach.Name=filename;
        attach.ParentID=empDetail.id;
        upsert(attach);
        
        
        }
           The above one is the FILE ATTATCHMENT CODE .In that code i didnt get any errors but file was not uploading .please tell me any issues are there for above code.

Thansk&Regards
RangaReddy

Hi,
 How to get the DEFAULT NAMES after saving the record.


Thanks

Ranga

Hi
  What is the difference between <apex:pageblock buttons> and <apex:commandbuttons> in salesforce.


Thanks&Regards
Ranga
How can we display 70,000 records in vf page?

I hope its not possible becuase the limit for vf page is 10,000 records, Is there any other work around for it, If so please help me

Hi
  please tell me what is the SERVICE CLOUD,what are all the new features in SERVICE CLOUD and which purpose we can go head and use the SERVICE CLOUD.


THANKS

RANGA

Hi
how to convert the STRING into MM/DD/YYYY through trigger.


Thanks
RANGA
Hi
    My Scenrio is i m having one picklist field with values are X,Y,Z and W and one dependent text field is there.whenever i was select the W value in the picklist ,text field was populating after that i entered some text and saving the page upto its fine.The problem is whenever i was going to EDIT the page the picklist field value i was changing from W to X,the test field value didint erase. Thetest field value should come blank.
  
 THANKS
RANGA

My requirement is 
In my VF PAGE ,whenever i was entered some value with the SEARCH functionality at the same time whenever i  was click on SUBMIT button that related records was displaying.whenever i was click on CLEAR button that related records will clear but it is not cleared.

THANKS

RANGA
 

Hi
Please tell me what is the difference between the CUSTOM APP and CONSOLE APP.


THANKS&REGARDS

RANGA

HI,
  My scenario is in my ROLE HIERARCHY, two users werw there ie ADMIN1 and ADMIN2.
   Under ADMIN1,   two  users were there ie USER1 and USER2.
  Under ADMIN2, two users were there ie USER1 and USER2. Above one was ROLE-HIERARCHY.
       I m having one page, in one page whenever i click on ADMIN1 i want to display USER1 and USER2 through some fileter reauirement.



THANKS

RANGA


 

CONTROLLER
-----------
public class EmployeeRelatedList {
 private Empolyee_Details__c empDetail;
 public blob picture{get;set;}
  public Integer counter {get; set;}
    public EmployeeRelatedList(ApexPages.StandardController stdController) {
        this.empDetail = (Empolyee_Details__c)stdController.getRecord();
    }
    public Pagereference save() {
        try{
             if(picture != null)
                          {
          Attachment attachment = new Attachment();
                   attachment.body = picture;
                    insert attachment;
                   }  
            upsert empDetail;
            return new Pagereference('/apex/Custom_pagenations');
        }
        catch(Exception e){
            Apexpages.addMessage(new Apexpages.Message(Apexpages.Severity.ERROR, e.getMessage()));
            return null;
        }
    }
}


VISUALFORCE PAGE
-----------------------
<apex:page standardController="Empolyee_Details__c" extensions="EmployeeRelatedList" tabStyle="Empolyee_Details__c">
  <apex:form >
    <apex:sectionHeader title="EmployeeInfo"/>
    <apex:pageBlock title="EmployeeData">
        <apex:pageBlockSection title="Empolyee basic Details" columns="2" collapsible="false">

              <apex:inputField value="{!Empolyee_Details__c.EmpId__c}"/>
            <apex:inputField value="{!Empolyee_Details__c.FirstName__c}"/>

            <apex:inputField value="{!Empolyee_Details__c.LastName__c}"/>
             <apex:inputField value="{!Empolyee_Details__c.MiddleName__c}"/>

            <apex:inputField value="{!Empolyee_Details__c.DateofBirth__c}"/>
             <apex:inputField value="{!Empolyee_Details__c.FatherMotherhusbandName__c}"/>

            <apex:inputField value="{!Empolyee_Details__c.MartialStatus__c}"/>
               </apex:pageBlockSection>
  
          <apex:pageBlockButtons >
            <apex:commandButton action="{!save}" value="SAVE"/>
        </apex:pageBlockButtons>

        <apex:inputfile value="{!Empolyee_Details__c.id}"></apex:inputfile>

    </apex:pageBlock>
     </apex:form>

</apex:page>
    
           my requirement is i want to attahement the file as well as uplaod the image.i used the attachment object but i didint get any attatchment or  image upload.

THANKS &REGARDS
RANGA