• hari0853701703454959
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 15
    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
I have two objects one is custom object (i.e.., bookingrequest__c)and another one is Account object.In Account object i have 6 customfields.How to access that 6fields in custom object using soql query.
1. Create a VF page where user can select an account from a pick-list.
2. Below the pick-list, there will be a text area for user to type message.
3. Below text area a Submit button is needed.
4. When user clicks on Submit, an email has to be sent to the selected account.
5. Email should have the message user typed in text area.
6. Email should have a dynamic unsubscribe link.
7. When recipient clicks on unsubscribe link it should take them to a public force.compage.
8. This page will ask recipient if they want to unsubscribe.
9. When recipient confirms, the  flag for sending emails should be set to false.
1. Create a VF page where user can select an account from a pick-list.
2. Below the pick-list, there will be a text area for user to type message.
3. Below text area a Submit button is needed.
4. When user clicks on Submit, an email has to be sent to the selected account.
5. Email should have the message user typed in text area.
6. Email should have a dynamic unsubscribe link.
7. When recipient clicks on unsubscribe link it should take them to a public force.compage.
8. This page will ask recipient if they want to unsubscribe.
9. When recipient confirms, the  flag for sending emails should be set to false.
Hi friends,

 1. custom object called invoice with field as
     a.invioce number(auto number)
     b.invioce date( date)
     c.Account Name(lookup with Account)
     d.invioce Amount(Roll up Summary,sumof allitems Price field of invioce Line Items object)
2.custom object called invoice Line Items with field as
    a.Invioce( Master Detail with Invioce)
    b.Product(Lookup with product)
    c.Quantity(Number)
     d.Unit Price(Currency)will contain price of one product
    e.Total Price((Formula, Quantity*Unit Price

My requirement:
Creat a  trigger on invoice line item to update account balence as sum fo all associated invoices amount for the account.(Create a custom field on Account Called "Account Balance" as currency data type)

Trigger updateamount on invoicelineitem (after insert){
       
    List <Account> acclist = new List<Account>();
    List<Id> accIds = new List<id>();
    for(invoicelineitem it : trigger.new){
          accIds.add(it.invoice.accountId);
     }

    for(account acc: [select id, invoice amount from account where id IN:accIds]) {
           for((invoicelineitem it : trigger.new){
               if(it.invoice.accountid == acc.id){
                       acc.invoiceamount = it.totalprice;
                       acclist.add(acc);
               }
           }
    }

   // update the accounts
    update acclist;

}
what are the changes I have done in trigger anybody can suggest 
Hi ,

  Can you make it so that the Lead Attempt count is reset to 0 if the Lead is moved from Lead Status = Nurture to Lead Status = Open.  If new tasks are created after status is changed to Open only the net new tasks should be counted.  DoesThey also have a new requirement.  Can you make it so that the Lead Attempt count is reset to 0 if the Lead is moved from Lead Status = Nurture to Lead Status = Open.  If new tasks are created after status is changed to Open only the net new tasks should be counted.
Thanks
hari

Hi,
  How to update the  all fields for task and  using Batchapex....
thanks,
hari
Hi Everyone,

    I have picklist ...inthat(10,25,50,100) values are there .I'm click 10 value in picklist  display only 10 records,and click25 display 25 records.after Im see record then comeback after sometime i have seen recent viewed record (i.e.,in checkbox)

Thanks 
hari
Hi Everyone,
I have Custom object DSR is a detail object of Opportunity
-On the DSR object, when the Status = Cancelled transfer ownership or DSR record to related Opportunity Owner
thanks&regards
hari
Baesd on CONTACT ID display the content in pdf format and also that pdfformat send the contact person
Thanks
Hareesh
I have one pdf format tha will send the candiadate in link format after click the link download that pdf
Iam create INTERVIEWER object  in that Status__c(i.e.., selected,rejected option are there).......if iam select Status__c(selected)then record save and automatically send an email that candidate...
Thanks&Regards

Hareesh
I have picklist (status__c) in that selected & rejected options are there.If, iam selected status=selected then record will be save otherwise record is not save.
Hi Everyone,

    I have picklist ...inthat(10,25,50,100) values are there .I'm click 10 value in picklist  display only 10 records,and click25 display 25 records.after Im see record then comeback after sometime i have seen recent viewed record (i.e.,in checkbox)

Thanks 
hari
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
Hello ,
Based on the requirement i have created few html email templates with the merge fields .When i use the templateid in the batch class and execute the batch class,the email which i get doesnot display the merge fields value .What may be issue .Any help very much appreciated.
Here is the code used to send an email notification for the 30 days .
Batch Class and Schedule Class :
global class ThirtyDaysNotificationEmail implements Database.Batchable < sObject >, Schedulable, Database.Stateful {
    global List<String> errorMessages = new List<String>();
    global Database.QueryLocator start(Database.BatchableContext bc) {
        
        Date ed = Date.today().addDays(30);
        System.debug(Date.today().addDays(30));
        
        set<Id> setContractIds = new set<Id>();

        for(Contract_role__c objContract: [SELECT  Contract__c FROM Contract_role__c WHERE Role__c = 'SA' AND Contract__r.EndDate =: ed]) {
            setContractIds.add(objContract.Contract__c);
        }
        
         return Database.getQueryLocator([Select  id, Contract_Name__c , EndDate ,Contact_Email__c, Contract_End_Date_2__c,  Account.Owner.Email ,Account.Owner.Manager.Email,Owner.Email,CustomerSignedId,OwnerId FROM Contract  WHERE Id IN: setContractIds AND SRR__c ='YES' AND Status__c IN('In Pipe','Pushed Forward ') AND Renewal_Status__c NOT IN ('Renewed','Renewed Lost')]);
    }

    global void execute(Database.BatchableContext bc, List < Contract > recs) {
        List < Messaging.SingleEmailMessage > mailList = new List < Messaging.SingleEmailMessage > ();
        for (Contract c: recs) {
            if (c.Contact_Email__c != null) {
                List < String > toAddresses = new List < String > ();
                List < String > CcAddresses = new List < String > ();
                Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                toAddresses.add(c.Contact_Email__c);
                ccAddresses.add(c.Account.Owner.Email);
               // toAddresses.add(c.Account.Owner.Manager.Email);
                mail.setToAddresses(toAddresses);
                mail.setCcAddresses(CcAddresses);
               // mail.setTargetObjectId(c.CustomerSignedId);
                mail.setTargetObjectId(c.OwnerId);
               // mail.setWhatId(c.Id);
                mail.setTemplateId('00X4B000000M3g7');
                mail.setSaveAsActivity(false);
               // mail.setSubject('Notification Before 100 Days of Contract End Date to Account Executive and Manager');
               // String messageBody = '<html><body>Hi ,The Contract Named ' + c.Contract_Name__c  + ',<br>Will get Expired within 100 Days . <br>Kindly take approriate action to inform the Customer.<br><br><b>Regards,</b><br>ADP</body></html>';
               // mail.setHtmlBody(messageBody);
                mailList.add(mail);
            }
        }
        Messaging.sendEmail(mailList);
    }

    global void finish(Database.BatchableContext bc) {
        AsyncApexJob aaj = [Select Id, Status, NumberOfErrors, JobItemsProcessed, MethodName, TotalJobItems, CreatedBy.Email from AsyncApexJob where Id =:BC.getJobId()];
        
        // Send an email to the Apex job's submitter notifying of job completion.
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        String[] toAddresses = new String[] {aaj.CreatedBy.Email};
        mail.setToAddresses(toAddresses);
        mail.setSubject('JOB Salesforce Thirty Days NotificationEmailtoCustomer Finished: ' + aaj.Status);
        String bodyText='Total Job Items ' + aaj.TotalJobItems + ' Number of records processed ' + aaj.JobItemsProcessed + ' with '+ aaj.NumberOfErrors + ' failures.\n';
        bodyText += 'Number of Error Messages ' + errorMessages.size() + '\n';
        bodyText += 'Error Message' + String.join(errorMessages, '\n');
        mail.setPlainTextBody(bodyText);
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
    }
    
    global void execute(SchedulableContext SC) {
        NotificationEmailtoAccountExecutive batchable = new NotificationEmailtoAccountExecutive();
        database.executebatch(batchable);
    }
}
HTML Email template Created :
User-added image

The output which i get without the merge fields is :
User-added image
Any help very much appreciated.
I have two objects one is custom object (i.e.., bookingrequest__c)and another one is Account object.In Account object i have 6 customfields.How to access that 6fields in custom object using soql query.
1. Create a VF page where user can select an account from a pick-list.
2. Below the pick-list, there will be a text area for user to type message.
3. Below text area a Submit button is needed.
4. When user clicks on Submit, an email has to be sent to the selected account.
5. Email should have the message user typed in text area.
6. Email should have a dynamic unsubscribe link.
7. When recipient clicks on unsubscribe link it should take them to a public force.compage.
8. This page will ask recipient if they want to unsubscribe.
9. When recipient confirms, the  flag for sending emails should be set to false.
Hi friends,

 1. custom object called invoice with field as
     a.invioce number(auto number)
     b.invioce date( date)
     c.Account Name(lookup with Account)
     d.invioce Amount(Roll up Summary,sumof allitems Price field of invioce Line Items object)
2.custom object called invoice Line Items with field as
    a.Invioce( Master Detail with Invioce)
    b.Product(Lookup with product)
    c.Quantity(Number)
     d.Unit Price(Currency)will contain price of one product
    e.Total Price((Formula, Quantity*Unit Price

My requirement:
Creat a  trigger on invoice line item to update account balence as sum fo all associated invoices amount for the account.(Create a custom field on Account Called "Account Balance" as currency data type)

Trigger updateamount on invoicelineitem (after insert){
       
    List <Account> acclist = new List<Account>();
    List<Id> accIds = new List<id>();
    for(invoicelineitem it : trigger.new){
          accIds.add(it.invoice.accountId);
     }

    for(account acc: [select id, invoice amount from account where id IN:accIds]) {
           for((invoicelineitem it : trigger.new){
               if(it.invoice.accountid == acc.id){
                       acc.invoiceamount = it.totalprice;
                       acclist.add(acc);
               }
           }
    }

   // update the accounts
    update acclist;

}
what are the changes I have done in trigger anybody can suggest 
1. custom object called invoice with field as
     a.invioce number(auto number)
     b.invioce date( date)
     c.Account Name(lookup with Account)
     d.invioce Amount(Roll up Summary,sumof allitems Price field of invioce Line Items object)
2.custom object called invoice Line Items with field as
    a.Invioce( Master Detail with Invioce)
    b.Product(Lookup with product)
    c.Quantity(Number)
     d.Unit Price(Currency)will contain price of one product
    e.Total Price((Formula, Quantity*Unit Price

My requirement:
Creat a  trigger on invoice line item to update account balence as sum fo all associated invoices amount for the account.(Create a custom field on Account Called "Account Balance" as currency data type)
Hi ,

  Can you make it so that the Lead Attempt count is reset to 0 if the Lead is moved from Lead Status = Nurture to Lead Status = Open.  If new tasks are created after status is changed to Open only the net new tasks should be counted.  DoesThey also have a new requirement.  Can you make it so that the Lead Attempt count is reset to 0 if the Lead is moved from Lead Status = Nurture to Lead Status = Open.  If new tasks are created after status is changed to Open only the net new tasks should be counted.
Thanks
hari

Hi,
  How to update the  all fields for task and  using Batchapex....
thanks,
hari
Hi Everyone,

    I have picklist ...inthat(10,25,50,100) values are there .I'm click 10 value in picklist  display only 10 records,and click25 display 25 records.after Im see record then comeback after sometime i have seen recent viewed record (i.e.,in checkbox)

Thanks 
hari
Hi Everyone,
I have Custom object DSR is a detail object of Opportunity
-On the DSR object, when the Status = Cancelled transfer ownership or DSR record to related Opportunity Owner
thanks&regards
hari
I have picklist (status__c) in that selected & rejected options are there.If, iam selected status=selected then record will be save otherwise record is not save.