• Hannah Campbell
  • NEWBIE
  • 45 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 3
    Replies
public class EmailHandler {
 
    public static void sendEmail2(){
        // Create Email and Send
        Messaging.SingleEmailMessage msg = new Messaging.SingleEmailMessage();
        msg.setCcAddresses(new String[] {'sample@sample.com'});
       
 msg.setTemplateId('email'); //Use the custom HTML Template
        msg.setTargetObjectId('003p000000Nklh9'); 
 msg.setSenderDisplayName('Administrator');
       
        msg.setSaveAsActivity(false); // so that it wont be saved as an activity
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { msg });
    }
}

Here is my Apex Class:
public class jobApplicationTempt{
    public Id JobApplicationId {get;set;}
    public List<Job_Application__c> getJobApplication(){
        List<Job_Application__c> listOfJobApp;
        listOfJobApp=[SELECT Position__r.Name, Name__c, Phone__c, Email__c From Job_Application__c WHERE status__c = 'Approved' ];
        return listOfJobApp;
    }
}

and this is my VF Component:

<apex:component controller="jobApplicationTempt" access="global">
    <apex:attribute name="JobAppId" type="Id" description="Id of the JobApplication" AssignTo="{!JobApplicationId}"/>
    <table border="2" cellspacing="5">
        <tr>
            <td>Position Name</td>
            <td>Candidate Name</td>
            <td>Candidate Phone</td>
            <td>Candidate Email</td>
        </tr>
        <apex:repeat value="{!JobApplications}" var="o">
        <tr>
            <td>{!o.Position__r.Name}</td>
            <td>{!o.Name}</td>
            <td>{!o.Phone}</td>
            <td>{!o.Email}</td>
        </tr>
        </apex:repeat>
    </table>
</apex:component>

I was trying to select the Position Name, Candidate Name, Candidate Phone, and Candidate Email for all the Job Application where the status is Approved

public class jobApplicationTempt{
    public Id JobApplicationId {get;set;}
    public List<Job_Application__c> getJobApplication(){
        List<Job_Application__c> listOfJobApp;
        listOfJobApp=[SELECT Name__c,Phone__c, Email__c From Job_Application__c WHERE status=="Approved"];
        return listOfJobApp;
    }
}

Im having an error with my code. Not really familiar with reverse method. Need help with checking this and creating a simple test class.

this is the code that I got so far:

public class Example {
    public static void reverseWordInMyString(String str){
        List<String> str = new List<String>{''};
            List<String> reversedString = new List<String>();
        if(!str.isEmpty()){
            for (String s : str){
                reversedString.add(s.reverse());
            }
        }
        System.debug(str);
        System.debug(reversedString);        
    }    
}

Thanks in advance

I need help with converting this java code:

public class Example{
  public static void reverseWordInMyString(String str){
   String[] words = str.split(" ");
   String reversedString = "";
   for (int i = 0; i < words.length; i++){
       String word = words[i];
       String reverseWord = "";
       for (int j = word.length()-1; j >= 0; j--){
  
         reverseWord = reverseWord + word.charAt(j);
      }
     reversedString = reversedString + reverseWord + " ";
   }
   System.out.println(str);
   System.out.println(reversedString);
  }
}

 

so far this is what i got :

public class Example {
    public static void reverseWordInMyString(String str){
        String[] words = str.split(' ');
        String reversedString = '';
        Integer i;
        Integer j;
        for(i=0; i<words.length(reversedString); i++){
            String reverseWord="";
            for(j = words.length(reverseWord)-1; j>=0; j--){
                reverseWord=reverseWord + word.charAt(j);
            }
            reversedString = reversedString + reverseWord + "";
        }
        System.debug(str);
        System.debug(reversedString);
    }
}

Can someone help me here. Im trying to convert this java code to apex code

This is the java code:

String stringVar = "";
if(stringVar.isEmpty()){
   System.out.println("Hello World");
}

This is the code I got so far and im not sure if it is correct:

String stringVar = '';
if(stringVar.isEmpty()){
    system.debug('Hello World');

}

Here is my Apex Class:
public class jobApplicationTempt{
    public Id JobApplicationId {get;set;}
    public List<Job_Application__c> getJobApplication(){
        List<Job_Application__c> listOfJobApp;
        listOfJobApp=[SELECT Position__r.Name, Name__c, Phone__c, Email__c From Job_Application__c WHERE status__c = 'Approved' ];
        return listOfJobApp;
    }
}

and this is my VF Component:

<apex:component controller="jobApplicationTempt" access="global">
    <apex:attribute name="JobAppId" type="Id" description="Id of the JobApplication" AssignTo="{!JobApplicationId}"/>
    <table border="2" cellspacing="5">
        <tr>
            <td>Position Name</td>
            <td>Candidate Name</td>
            <td>Candidate Phone</td>
            <td>Candidate Email</td>
        </tr>
        <apex:repeat value="{!JobApplications}" var="o">
        <tr>
            <td>{!o.Position__r.Name}</td>
            <td>{!o.Name}</td>
            <td>{!o.Phone}</td>
            <td>{!o.Email}</td>
        </tr>
        </apex:repeat>
    </table>
</apex:component>

I was trying to select the Position Name, Candidate Name, Candidate Phone, and Candidate Email for all the Job Application where the status is Approved

public class jobApplicationTempt{
    public Id JobApplicationId {get;set;}
    public List<Job_Application__c> getJobApplication(){
        List<Job_Application__c> listOfJobApp;
        listOfJobApp=[SELECT Name__c,Phone__c, Email__c From Job_Application__c WHERE status=="Approved"];
        return listOfJobApp;
    }
}

Im having an error with my code. Not really familiar with reverse method. Need help with checking this and creating a simple test class.

this is the code that I got so far:

public class Example {
    public static void reverseWordInMyString(String str){
        List<String> str = new List<String>{''};
            List<String> reversedString = new List<String>();
        if(!str.isEmpty()){
            for (String s : str){
                reversedString.add(s.reverse());
            }
        }
        System.debug(str);
        System.debug(reversedString);        
    }    
}

Thanks in advance