• Dheeraj Chawla
  • NEWBIE
  • 54 Points
  • Member since 2015

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 6
    Replies
Hi,
how to write test class for below coding.Plz help asap

global class Batch_to_SentEmailNotify implements Database.Batchable<sObject> 
 {
   global Database.QueryLocator start(Database.BatchableContext BC) 
    {
       string s='Blocked';
        String query = 'Select Resort_Master__r.Name,Executive_Name__r.Email__c,Name_of_the_Guest__c,Company_Name__c,Block_Release_Date__c,Check_In__c,Check_Out__c,Total_Number_of_Rooms_Booked__c,Booking_Status__c,Source__c,Market_Segment__c,Executive_Name__r.Name FROM Non_Member_Booking_Request__c where Booking_Status__c=: s';
        return Database.getQueryLocator(query);
    }
   
    global void execute(Database.BatchableContext BC, List<Non_Member_Booking_Request__c> scope) 
    {
         for(Non_Member_Booking_Request__c c : scope)
         {
           system.debug('++++++++++++++system.today ++++++++++++++'+system.today());
            string email = c.Executive_Name__r.Email__c;
            if(email !=null && (system.today() == c.Check_In__c))
            {
              Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
              mail.setUseSignature(false);
              mail.setToAddresses(new String[] { email});
              mail.setSubject('Booking Confirmation ');
              mail.setHtmlBody('Dear Team <br/>'+'Namaste !!!!<br/>'+'Please find the attached payment details of below room reservation.<br/>'+'Please check and confirm the CV with updated payment details.<br/>'
              );
              Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
              system.debug('@@@@@@@@@@@@@@@mail@@@@@@@@@@@@@@@'+mail);
            
           }
         }   
    }
    global void finish(Database.BatchableContext BC) 
    {
    }
}
Regards,
Hareesh
Hi,
I am trying to create a formula field on Case and I want an opportunity field in my formula but I do not have the option to choose opportunity object nor its fields. I understand I need to establish a relationship between Case and Opportunioty. Could someone tell me how I can do this? If the only way is creating a trigger then could you help me with how to create such a trigger as well please?  

Thanks, Jayashree
I've been working on an Org where a very large number (over 20,000) of Contacts have been deleted, then emptied from the Recycle Bin.

The Recycle Bin was emptied several days ago, but the Contacts are still visible with IsDeleted = true with an ALL ROWS SOQL query.

All the Salesforce documentation says is that the time to permanently delete emptied recycle bin records will be 'usually 24 hours but may be longer or shorter'. 

We have raised a Case with Salesforce Support, who suggested using the emptyRecycleBin method, but this has not worked as the Recycle Bin no longer contains the records in question.

Because we are using an ALL ROWS query in another part of our application these deleted records are causing problems - does anybody have any suggestions about how I can remove them?
how can I assign set & list values to map? and map values to set and list?
Hi, 

  We have a email field which is in firstname.lastname@domain.com format my requrement is to extract only the firstname from email field. please suggest me how to extract.

I tried below method which is returning firstname.lastname 
 
LEFT( Owner_Email__c,FIND( "@",Owner_Email__c ) - 1  )

Also when returning firstname can we keep the first letter as capital letter using formula please let me now

Thanks
Sudhir