• Njanga
  • NEWBIE
  • 50 Points
  • Member since 2012

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 15
    Questions
  • 18
    Replies

I have a controller that sends notications a month before a candidate's birthday. I can't seem to cover the else part of my if statements in my test class.The red parts being the ones not covered.

Kindly assist:

 

public class candidateEmailNotification{

public List<Candidates__c> candidates = [select First_Name__c,Name,Date_of_Birth__c
                         from Candidates__c];
       
 
       public List<Candidates__c> includeInEmail(){  
            
              List<Candidates__c> newcadidates = new  List<Candidates__c>(); 
              for(Candidates__c c: candidates) {

                  
                    if(c.Date_of_Birth__c==null){
                    
                    }
               else{
                    
              
               if(c.Date_of_Birth__c.dayOfYear() - System.today().dayOfYear()==30){

               
               newcadidates.add(c);
             
               }
               
           }
          } 

          return newcadidates;
        } 
        
        
        
     public String composeMessage(){
     
        
       String emailMsg = '';
       List<Candidates__c> c = includeInEmail();

       if(includeInEmail().size()==0){
       return null;
          }else{
       for(Integer i = 0;i< c.size(); i++){ emailMsg += '<tr><td>'+c.get(i).First_Name__c +'</td><td>'+c.get(i).Name+'</td><td style = color:red> '+c.get(i).Date_of_Birth__c.day()+ ' - '+c.get(i).Date_of_Birth__c.month() +' - '+System.today().year()+'</td></tr>';
       
    
       }
      
       
        } 
         
       return '<table><tr><th>First Name </th><th>Last Name</th><th>Birthday</th></tr>'+emailMsg+'</table>';
        }           
  
    public void sendMail() {
         if(composeMessage()==null){
         
         }else{
 
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); String[] toAddresses = new String[] {'martin.mathu@jjpeople.com'}; mail.setToAddresses(toAddresses); mail.setSubject(' Birthday Notification'); mail.setUseSignature(false); mail.setHtmlBody('<div style=color:green;><u>The Following Candidate(s) Have Birthday in one Month Time</u></div><br>' + composeMessage()); // Send the email Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });  
    }
    }

}

 Below is my test class:

@isTest
public class CandidateEmailNotificationTest {
    static testMethod void EmailNotificationTest() {
        List<Candidates__c> cand =  new List<Candidates__c>();
        Candidates__c candidate = new Candidates__c(Candidate_Source__c='Monster',Main_Email__c='emaill@email.com',Candidate_Mobile_Phone__c='000',Name ='LastN',First_Name__c = 'Tester',Candidate_Address__c='000',Date_of_Birth__c = System.today());
        Candidates__c candidate2 = new Candidates__c(Candidate_Source__c='test',Main_Email__c='emaill2@email.com',Candidate_Mobile_Phone__c='0011',Name ='LastN2',First_Name__c = 'Tester2',Candidate_Address__c='00022',Date_of_Birth__c = System.today());
        cand.add(candidate);
        cand.add(candidate2);
        insert cand;        
        
        Test.startTest();
        candidateEmailNotification cn =  new candidateEmailNotification();
        cn.candidates = cand;
        cn.includeInEmail();
        cn.composeMessage();
        cn.sendMail();       
        Test.stopTest();
                
        System.assertEquals(candidate.Date_of_Birth__c, System.today());
        }

}

 

I was wondering if its possible to redirect a user to a page after login if certain criteria is not met.

 in my case I have unresolved emails, so what I wanted is to check if user has more than maybe ten unresolved item and redirect the user to unresolved items page.

 

Is it possible to do that and if possible how can I go about it.

Thank you

  • November 13, 2012
  • Like
  • 0

Am loading my vf pages using jquery.

This is what am doing it

 

I have a man page with a div that am loading other vf pages using jquery.load method and so far its working

but my disappointment is that my pages are taking too long to load  and sometimes they freeze the main page.

Is there a way to increase performance.

Thank you.

  • October 03, 2012
  • Like
  • 0

Hi guys, am stuck here, can someone help me please;

 

I have 2 selectList, one for unassigned processes and another for assigned processes;

so far i can move processes from unassigned to assigned and also am able to re-order them using jquery .

 

This is my code;

 

******************************  vf page*********************************

 

 

<apex:panelGrid columns="3" id="ad1">
                <apex:panelGroup >
                <u> <apex:outputText style="font-size:16px;" value="Unassigned Processes" /></u><br/><br/>
                   <select multiple="false" id="select1" style="width:350px" size="10">
                     <apex:repeat value="{!Ovalues}" var="Opt" >
                         <option value="{!Opt}"> {!Opt}</option>
                      </apex:repeat>  
                    </select><br/>
                     <input type = "image" src="{!$Resource.up}" style="width:30px;height:20" id ="up" />
                     <input type = "image" src="{!$Resource.down}" style="width:30px;height:20" id ="down" />
                </apex:panelGroup>
                <apex:panelGroup >
                    <br/><br/><br/><br/><br/>
                    <input type = "image" src="{!$Resource.right}" style="width:30px;height:20" id ="left" />
                        
                    <br/>
                    <br/>
                    <input type = "image" src="{!$Resource.left}" style="width:30px;height:20" id ="right" />
                </apex:panelGroup>
                <apex:panelGroup >
                 <u><apex:outputText style="font-size:16px;" value="Assigned Processes" /></u><br/><br/>
                   <select multiple="true" id="select2" style="width:350px" size="10">
                     <apex:repeat value="{!assigned}" var="Opt" >
                         <option value="{!Opt}"> {!Opt}</option>
                      </apex:repeat>  
                    </select><br/>
                   <input type = "image" src="{!$Resource.up}" style="width:30px; height:20" id ="rup" />
                   <input type = "image" src="{!$Resource.down}" style="width:30px; height:20" id ="rdown" />
                   <br/><br/><br/><br/>
                   <apex:commandButton value="Save" action="{!save}"/>
                    <apex:commandButton value="Cancel"/>
                </apex:panelGroup>
            
        </apex:panelGrid>

 

 

********************************* controller*********************************************

 

 

public class ProcessController {

 
     Set<String> originalvalues = new Set<String>{'Include Unsubscribe',
                                                  'Authority to Represent',
                                                  'NDA Needed',
                                                  'References needed',
                                                  'P33 Interview',
                                                  'Submit CV to Client',
                                                  'Client Interview',
                                                  'Optain Offer'};
                                                  

 
   public Set<String> assigned {get;set;}
   

                                                  
   public Set<String> getOvalues(){
    
    return originalvalues;
   
    }
    
    
    
    public ProcessController(){
        String id = ApexPages.currentPage().getParameters().get('id');
            if(id !=''){
            JobApplicant_ATS__c applicant = [Select Applicant_Name__c From JobApplicant_ATS__c where id=:id];
            
            ApplicantName = applicant.Applicant_Name__c;
            List<ApplicantAssignedProcess__c> asspro = [Select Process__c,Level__c,ApplicantId__c From
                                                        ApplicantAssignedProcess__c Where ApplicantId__c=:id Order By Level__c];
            
            assigned = new Set<String>();
            if(asspro.size()!=0){
            
                for(ApplicantAssignedProcess__c asp:asspro){
                
                    assigned.add(asp.Process__c);
                
                
                }
            
            }
          }   
      }
      
      
  }

 

  • September 13, 2012
  • Like
  • 0

I Want to render content with different css style;

This is my vf code.

<apex:pageblocktable value="{!queryResult}" var="cso">
     <apex:column value="{!cso.status}"  style="{!if(cso.status == 'complete','background:green;font-weight: bold', 'color:black')}"  headervalue="Status" />
</apex:pageblocktable>

 

This is Working.

Now what i need is to add another condition to check if cso.status == 'in progress' and set a pink background.

 

  • August 31, 2012
  • Like
  • 0

Hi Guys,

Can someone help me out here!


This is my situation:

I have two custom objects Job_ATS__c and Shortlists__c.

Job_ATS__c is the Parent and Shortlists__c is the Child. The relationship is one to many.


That means one job can have many shortlists and each shortlist has a Status__c. Status are 'Interested' or 'Not Interested'

 

So what I want is a query that will return Job Name and count for Interested and Not Interested shortlists.

 

E.g...

 

Job_ATS__c                      Shortlists__c                                                                           Desired Result

______________         __________________________________                       ______________________________
Job Name       id             Shortlist Name       id     job_id   Status                                   Job Name   Interested     Not Interested
______________         __________________________________                       _______________________________
Job1                 1               Shortlist1                1        1          Interested                             Job1                1                        1  
Job2                 2               Shortlist2                2        1          Not Interested                      Job2                1                        0

                                           Shortlist3                3         2          interested

 

I need to Display the desired result on Vf page.

  • August 28, 2012
  • Like
  • 0

Hi Guys,

Can someone help me out here!


This is my situation:

I have two custom objects Job_ATS__c and Shortlists__c.

Job_ATS__c is the Parent and Shortlists__c is the Child. The relationship is one to many.


That means one job can have many shortlists and each shortlist has a Status__c. Status are 'Interested' or 'Not Interested'

 

So what I want is a query that will return Job Name and count for Interested and Not Interested shortlists.

 

E.g...

 

Job_ATS__c                      Shortlists__c                                                                           Desired Result

______________         __________________________________                       ______________________________
Job Name       id             Shortlist Name       id     job_id   Status                                   Job Name   Interested     Not Interested
______________         __________________________________                       _______________________________
Job1                 1               Shortlist1                1        1          Interested                             Job1                1                        1  
Job2                 2               Shortlist2                2        1          Not Interested                      Job2                1                        0

                                           Shortlist3                3         2          interested

 

I need to Display the desired result on Vf page.

 

  • August 28, 2012
  • Like
  • 0

Hi guys,

Am  stuck here and I really need your help.

I have two custom objects Jobs__c and Shortlists__c.

Jobs__c is the Parent object and Shortlists__c is the child object.

 

Each Job can have many shortlists. Now what I want is to write a query will retrieve Job Name with corresponding number of shortlists

 

 

E.g.

 

______________________
Job Name       No.Shortlists
______________________
J2ee                 10           

______________________

  • August 27, 2012
  • Like
  • 0

Hi guys,

am getting date in this format.

this is sample date:  Thu Aug 09 00:00:00 GMT 2012

how do i format it as 23/09/2012

 

Thank you!.

  • August 23, 2012
  • Like
  • 0

Hi guys,

I have a vf page and a button to add a record.

This is my button in vf.

 

<apex:commandButton value="New Job" id="newJob" action="{!URLFOR($Action.Job_ATS__c.new)}" />

 

Now the problem is when I click on my button its showing an error.

This is the error am getting.

 

Error:

Value 'false' cannot be converted from Boolean to common.api.soap.wsdl.ID

 

Pliz Help!

  • August 21, 2012
  • Like
  • 0

Am really stuck here!

I have 2 custom objects Candidates__c and Applicant__c.

Candidate__c is the Parent Object and Applicant__c is the child object.

Now i have a custom button on Applicant__c standard page that is executing a javascript&colon;

What i want is to write a query to get Email from Candidate__c Object.

I have tried to write some query and this is what i have:

 

{!REQUIRESCRIPT("/soap/ajax/15.0/connection.js")}

var result = sforce.connection.query("Select Main_Email__c From Candidate__c where Name={!Applicant__c.Candidate_Name__c}");

In this Query i can't get the unique record for that Applicant becouse am using Name in where clouse;

How do i use id in where clouse or how do i get Email for that Applicant.

Please Help!

  • August 10, 2012
  • Like
  • 0

i  have a javascript that is querying my custom object. what i want is to get an email value. this is my javascript

 

{!REQUIRESCRIPT("/soap/ajax/15.0/connection.js")}
var result = sforce.connection.query("Select Main_Email__c From Candidate_ATS__c where Name ='{!JobApplicant_ATS__c.Candidate_Name__c}' ");
var records = result.getArray("records");

//If there are no  record
if (records.length == 0){
alert("no record");
}
//If there is a record
else{
alert(records);
}

 

When i alert records this is what am getting:

 

{type:'Candidate_ATS__c', Id:null, Main_Email__c:'abc@abc.com', }

 

pliz help get my email i.e. abc@abc.com

  • August 09, 2012
  • Like
  • 0

Hi,

Do anyone know the best resume parser that I can integrate with salesforce or a company that has webservices for parsing resumes that I can integrate with salesforce.

Send

 

 


Edit Email
Email Format Text-Only  [ Switch to HTML ]
To
Related To
Additional To:njangadavid@yahoo.com 
CC: 
BCC: 
*Subject Resume submited
Body

Dear xxxx.

 

This is to notify you that resume has been submitted.

Regards,

xxxxx.

 
 
 
 
 
 
 
 
 
  
 
   

This is my emailauthor.jsp and what i want is to load a different page when i click send button instead of the default page. How do i accomplish that or how can i override send button so that i can load a different page. Thank You in advance.

Is it posible to add  an event listener on standard page picklist e.g onChange.

I have custom object which has a picklist as one of the fields, the picklist contains a couple of values. I want a textarea to be shown underneath the picklist when a value has been changed in the picklist. To add on this, how does one manipulate the standard VisualForce page that comes with  every custom object created.

I Want to render content with different css style;

This is my vf code.

<apex:pageblocktable value="{!queryResult}" var="cso">
     <apex:column value="{!cso.status}"  style="{!if(cso.status == 'complete','background:green;font-weight: bold', 'color:black')}"  headervalue="Status" />
</apex:pageblocktable>

 

This is Working.

Now what i need is to add another condition to check if cso.status == 'in progress' and set a pink background.

 

  • August 31, 2012
  • Like
  • 0

Hi Guys,

Can someone help me out here!


This is my situation:

I have two custom objects Job_ATS__c and Shortlists__c.

Job_ATS__c is the Parent and Shortlists__c is the Child. The relationship is one to many.


That means one job can have many shortlists and each shortlist has a Status__c. Status are 'Interested' or 'Not Interested'

 

So what I want is a query that will return Job Name and count for Interested and Not Interested shortlists.

 

E.g...

 

Job_ATS__c                      Shortlists__c                                                                           Desired Result

______________         __________________________________                       ______________________________
Job Name       id             Shortlist Name       id     job_id   Status                                   Job Name   Interested     Not Interested
______________         __________________________________                       _______________________________
Job1                 1               Shortlist1                1        1          Interested                             Job1                1                        1  
Job2                 2               Shortlist2                2        1          Not Interested                      Job2                1                        0

                                           Shortlist3                3         2          interested

 

I need to Display the desired result on Vf page.

  • August 28, 2012
  • Like
  • 0

Hi Guys,

Can someone help me out here!


This is my situation:

I have two custom objects Job_ATS__c and Shortlists__c.

Job_ATS__c is the Parent and Shortlists__c is the Child. The relationship is one to many.


That means one job can have many shortlists and each shortlist has a Status__c. Status are 'Interested' or 'Not Interested'

 

So what I want is a query that will return Job Name and count for Interested and Not Interested shortlists.

 

E.g...

 

Job_ATS__c                      Shortlists__c                                                                           Desired Result

______________         __________________________________                       ______________________________
Job Name       id             Shortlist Name       id     job_id   Status                                   Job Name   Interested     Not Interested
______________         __________________________________                       _______________________________
Job1                 1               Shortlist1                1        1          Interested                             Job1                1                        1  
Job2                 2               Shortlist2                2        1          Not Interested                      Job2                1                        0

                                           Shortlist3                3         2          interested

 

I need to Display the desired result on Vf page.

 

  • August 28, 2012
  • Like
  • 0

Hi guys,

Am  stuck here and I really need your help.

I have two custom objects Jobs__c and Shortlists__c.

Jobs__c is the Parent object and Shortlists__c is the child object.

 

Each Job can have many shortlists. Now what I want is to write a query will retrieve Job Name with corresponding number of shortlists

 

 

E.g.

 

______________________
Job Name       No.Shortlists
______________________
J2ee                 10           

______________________

  • August 27, 2012
  • Like
  • 0

Hi guys,

am getting date in this format.

this is sample date:  Thu Aug 09 00:00:00 GMT 2012

how do i format it as 23/09/2012

 

Thank you!.

  • August 23, 2012
  • Like
  • 0

Hi guys,

I have a vf page and a button to add a record.

This is my button in vf.

 

<apex:commandButton value="New Job" id="newJob" action="{!URLFOR($Action.Job_ATS__c.new)}" />

 

Now the problem is when I click on my button its showing an error.

This is the error am getting.

 

Error:

Value 'false' cannot be converted from Boolean to common.api.soap.wsdl.ID

 

Pliz Help!

  • August 21, 2012
  • Like
  • 0

Am really stuck here!

I have 2 custom objects Candidates__c and Applicant__c.

Candidate__c is the Parent Object and Applicant__c is the child object.

Now i have a custom button on Applicant__c standard page that is executing a javascript&colon;

What i want is to write a query to get Email from Candidate__c Object.

I have tried to write some query and this is what i have:

 

{!REQUIRESCRIPT("/soap/ajax/15.0/connection.js")}

var result = sforce.connection.query("Select Main_Email__c From Candidate__c where Name={!Applicant__c.Candidate_Name__c}");

In this Query i can't get the unique record for that Applicant becouse am using Name in where clouse;

How do i use id in where clouse or how do i get Email for that Applicant.

Please Help!

  • August 10, 2012
  • Like
  • 0

i  have a javascript that is querying my custom object. what i want is to get an email value. this is my javascript

 

{!REQUIRESCRIPT("/soap/ajax/15.0/connection.js")}
var result = sforce.connection.query("Select Main_Email__c From Candidate_ATS__c where Name ='{!JobApplicant_ATS__c.Candidate_Name__c}' ");
var records = result.getArray("records");

//If there are no  record
if (records.length == 0){
alert("no record");
}
//If there is a record
else{
alert(records);
}

 

When i alert records this is what am getting:

 

{type:'Candidate_ATS__c', Id:null, Main_Email__c:'abc@abc.com', }

 

pliz help get my email i.e. abc@abc.com

  • August 09, 2012
  • Like
  • 0

Hi,

Do anyone know the best resume parser that I can integrate with salesforce or a company that has webservices for parsing resumes that I can integrate with salesforce.

I have a controller that sends notications a month before a candidate's birthday. I can't seem to cover the else part of my if statements in my test class.The red parts being the ones not covered.

Kindly assist:

 

public class candidateEmailNotification{

public List<Candidates__c> candidates = [select First_Name__c,Name,Date_of_Birth__c
                         from Candidates__c];
       
 
       public List<Candidates__c> includeInEmail(){  
            
              List<Candidates__c> newcadidates = new  List<Candidates__c>(); 
              for(Candidates__c c: candidates) {

                  
                    if(c.Date_of_Birth__c==null){
                    
                    }
               else{
                    
              
               if(c.Date_of_Birth__c.dayOfYear() - System.today().dayOfYear()==30){

               
               newcadidates.add(c);
             
               }
               
           }
          } 

          return newcadidates;
        } 
        
        
        
     public String composeMessage(){
     
        
       String emailMsg = '';
       List<Candidates__c> c = includeInEmail();

       if(includeInEmail().size()==0){
       return null;
          }else{
       for(Integer i = 0;i< c.size(); i++){ emailMsg += '<tr><td>'+c.get(i).First_Name__c +'</td><td>'+c.get(i).Name+'</td><td style = color:red> '+c.get(i).Date_of_Birth__c.day()+ ' - '+c.get(i).Date_of_Birth__c.month() +' - '+System.today().year()+'</td></tr>';
       
    
       }
      
       
        } 
         
       return '<table><tr><th>First Name </th><th>Last Name</th><th>Birthday</th></tr>'+emailMsg+'</table>';
        }           
  
    public void sendMail() {
         if(composeMessage()==null){
         
         }else{
 
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); String[] toAddresses = new String[] {'martin.mathu@jjpeople.com'}; mail.setToAddresses(toAddresses); mail.setSubject(' Birthday Notification'); mail.setUseSignature(false); mail.setHtmlBody('<div style=color:green;><u>The Following Candidate(s) Have Birthday in one Month Time</u></div><br>' + composeMessage()); // Send the email Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });  
    }
    }

}

 Below is my test class:

@isTest
public class CandidateEmailNotificationTest {
    static testMethod void EmailNotificationTest() {
        List<Candidates__c> cand =  new List<Candidates__c>();
        Candidates__c candidate = new Candidates__c(Candidate_Source__c='Monster',Main_Email__c='emaill@email.com',Candidate_Mobile_Phone__c='000',Name ='LastN',First_Name__c = 'Tester',Candidate_Address__c='000',Date_of_Birth__c = System.today());
        Candidates__c candidate2 = new Candidates__c(Candidate_Source__c='test',Main_Email__c='emaill2@email.com',Candidate_Mobile_Phone__c='0011',Name ='LastN2',First_Name__c = 'Tester2',Candidate_Address__c='00022',Date_of_Birth__c = System.today());
        cand.add(candidate);
        cand.add(candidate2);
        insert cand;        
        
        Test.startTest();
        candidateEmailNotification cn =  new candidateEmailNotification();
        cn.candidates = cand;
        cn.includeInEmail();
        cn.composeMessage();
        cn.sendMail();       
        Test.stopTest();
                
        System.assertEquals(candidate.Date_of_Birth__c, System.today());
        }

}

 

Is it posible to add  an event listener on standard page picklist e.g onChange.

I have custom object which has a picklist as one of the fields, the picklist contains a couple of values. I want a textarea to be shown underneath the picklist when a value has been changed in the picklist. To add on this, how does one manipulate the standard VisualForce page that comes with  every custom object created.