+ Start a Discussion

Help with Record update from site.com

Hi people,

I have a scenario whereby am supposed to send an email notification to a contact for interview feedback once the interview end time has passed.How do i set the where clause for Interview_End_Date_Time__c to meet this criteria so that my scheduler will be fired & send the email as well as be able to get the record on which the field should be updated. So far i have the following as my rough trial. The problem with my code is that it seems to hit 'The authorization required page' after insert instead of returning the successful page & my record is not update.However when i use other specific fields with constant value instead of the time field,my record is successfully updated.How do i get the where clause right as well as get to update the right record based on the record id,considering i had a problem including the record id on my site.com url.


public with sharing class InterviewFeedbackController {
  public InterviewFeedbackController() {
    // blank constructor
  public String intvName = ' ';   
        public Datetime dt = datetime.now(); 
        public List<Interviews_ATS__c> interv = [Select id,Name,Interview_Start_Date_Time__c,Interview_End_Date_Time__c,Client_Name__c,interview_level__c from Interviews_ATS__c where Interview_End_Date_Time__c = :dt];
 public String userInput;
 public String getUserInput() {
 	return userInput;
 public void setUserInput(String userInp) {
 	this.userInput = userInp;

 public PageReference submit() {  
 	List<Interviews_ATS__c> intv = [Select Id,Name,Interview_Start_Date_Time__c,Interview_End_Date_Time__c,Client_Name__c,interview_level__c from Interviews_ATS__c where Id = :interv[0].id];
      if (!intv.isEmpty()) {
      	Interviews_ATS__c interview = intv[0];
    	intv[0].Interview_Feedback__c = userInput;
    	update interview;
      return Page.Interview_feedback_Note;
  public void sendNotification() {    
        for(Integer i=0; i < interv.size(); i++){
            intvName += interv[i].Name +', ';
        if(interv.size() != 0){
        Messaging.Singleemailmessage email = new Messaging.Singleemailmessage();
        String [] toAddresses = New String[]{'xxx.xxx@xxx.com'};
        email.setSubject('Interview Feedback');
        email.setPlainTextBody('Kindly send me the interview feedback for interview:' +intvName+ 'Click the link https://xxx.sandbox1.cs3.force.com/interviewfeedbacks');
        //Send the email
        Messaging.sendEmail(New Messaging.Singleemailmessage[]{email}); 

 scheduler class:


global class ScheduleInterviewFeedback implements Schedulable{
      global void execute(SchedulableContext ctx) {
      InterviewFeedbackController sc =  new InterviewFeedbackController();