• Cool Guy
  • NEWBIE
  • 35 Points
  • Member since 2014

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 5
    Replies
So I am trying to create my first batch class, and I am MORE THAN a little confused.  I created two classes.

<pre>
global class BatchUpdate_Financials implements Database.Batchable<sObject>
{
    global Database.QueryLocator start(Database.BatchableContext BC)
    {
        String query = 'SELECT Id,Name,status__c FROM Financial_Planning__c ';
        return Database.getQueryLocator(query);
    }

    global void execute(Database.BatchableContext BC, List<Financial_Planning__c> scope)
    {
        for (Financial_Planning__c fp : scope){

         if(fp.status__c == 'Active')
          update fp;

        }
    } 
    global void finish(Database.BatchableContext BC)
    {
    }
}
</pre>

<pre>
global class Scheduler_class implements Schedulable{

    public static String sched = '0 00 00 * * ?';  //Every Day at Midnight

    global static String scheduleMe() {
        Scheduler_class SC = new Scheduler_class();
        return System.schedule('My batch Job', sched, SC);
    }

    global void execute(SchedulableContext sc) {

        BatchUpdate_Financials fp = new BatchUpdate_Financials();
        ID batchprocessid = Database.executeBatch(fp,50);          
    }
}
</pre>

Then I read I have to type something like this in the Developer Console to actually schedule the job.

<pre>
Scheduler_class sch1 = New Scheduler_class();
String sch = '0 00 02 * * ?';
System.Schedulable('Financials Update', sch, sch1);
</pre>

But when i do, I get this error: "Method does not exist or incorrect signature: System.Schedulable(String, String, Scheduler_class)"

Any ideas what I am doing wrong?
Hi, 

We are doing an Integration using SOAP services.

For that, third party gave us SSL certificate in .pfx format along with password. I have doubt that how to use that certificate in our Request.  I opened that certificate and used the content of it in my code and I got ' No Certificate found' Error. How can I resolve this issue.  May I know the Procedure to Integrate using SOAP services.


Hi,  
I have a small issue regarding emails.

I have Enterprise Edition with 447 user Licences and I have nearly 1,00,000 Accounts in my Account Object, I need to send an email to those Accounts at a time.
To send Email I scheduled a class a Batch Class , Here is the Batch Class .

global class SurveyBatchProcessForActiveAndInactive implements Database.Batchable<Opportunity>
{   
    //Query Opportunity fields with active,inactive stages and Department is Aus and also RecordType is AUS
    
    global Iterable<Opportunity> start(Database.BatchableContext BC)
    {
        Opportunity[] opp=[select id,Account.Person_Email__c,Account.Id from Opportunity where Account.Person_Email__c != Null];
        system.debug('Opportunity Size'+opp.size());   
        return opp;
    }
   
    //sent email to opportunity clients those are returned by start method
         
    global void execute(Database.BatchableContext BC, List<Opportunity> opprecords)
    {
        List<Messaging.SingleEmailMessage> mails  = new List<Messaging.SingleEmailMessage>();
           //To sent email to clients
           for(Opportunity opp:opprecords)
           {
            Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); 
            List<String> toAddresses = new List<String>(); 
            toAddresses.add(opp.Account.Person_Email__c);                                
            String htmlbodystring  = 'Some Text goes Here'+opp.id;   
               
                  email.setToAddresses(toAddresses);
                  email.setHTMLBody(htmlbodystring);
                  email.setSubject('Test');
                 
                  mails.add(email);    
         }         
         Messaging.sendEmail(mails);  
    }
   
   //Life Cycle method of Batch Class
    global void finish(Database.BatchableContext BC){
         
    }
}


While running this class, I got SINGLE_EMAIL_LIMIT_EXCEEDED error. How to Solve this issue please help me
Hi,

I have a small issue that I am getting 'TEMPLATE_NOT_FOUND, The record couldn't be saved because it triggered an email alert that failed' issue.

It is coming while i am converting the Lead through Database.convertLead(lc) method. Please help me how to resolve it
Hi,

I have a small issue regrading file preview in chatter. I uploaded a .docx file in chatter, when i open the file in chatter, it was showing no preview available, but it is working fine for pdf format files, I Enabled 'Enable Office 2007 previews in content' permission. Then also i am unable to preview, Is there any another permission to preview the file.

Please help me.
Hi,

I have a requirement like, I need to get Propects data from a Third Party API and then I have to insert those prospects in SF. I am able to get the data from that Third Party API, But I have a issue over here, It will give only 200 prospects information in the form of XML at a time, But I need to get all Prospects Information. For that I need to call that Third Party URL based on total number of Prospects . If I do this I will Get CallOut Exception.

So how to over come this, Please Help me.
Hi, 

We are doing an Integration using SOAP services.

For that, third party gave us SSL certificate in .pfx format along with password. I have doubt that how to use that certificate in our Request.  I opened that certificate and used the content of it in my code and I got ' No Certificate found' Error. How can I resolve this issue.  May I know the Procedure to Integrate using SOAP services.


Hi,  
I have a small issue regarding emails.

I have Enterprise Edition with 447 user Licences and I have nearly 1,00,000 Accounts in my Account Object, I need to send an email to those Accounts at a time.
To send Email I scheduled a class a Batch Class , Here is the Batch Class .

global class SurveyBatchProcessForActiveAndInactive implements Database.Batchable<Opportunity>
{   
    //Query Opportunity fields with active,inactive stages and Department is Aus and also RecordType is AUS
    
    global Iterable<Opportunity> start(Database.BatchableContext BC)
    {
        Opportunity[] opp=[select id,Account.Person_Email__c,Account.Id from Opportunity where Account.Person_Email__c != Null];
        system.debug('Opportunity Size'+opp.size());   
        return opp;
    }
   
    //sent email to opportunity clients those are returned by start method
         
    global void execute(Database.BatchableContext BC, List<Opportunity> opprecords)
    {
        List<Messaging.SingleEmailMessage> mails  = new List<Messaging.SingleEmailMessage>();
           //To sent email to clients
           for(Opportunity opp:opprecords)
           {
            Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); 
            List<String> toAddresses = new List<String>(); 
            toAddresses.add(opp.Account.Person_Email__c);                                
            String htmlbodystring  = 'Some Text goes Here'+opp.id;   
               
                  email.setToAddresses(toAddresses);
                  email.setHTMLBody(htmlbodystring);
                  email.setSubject('Test');
                 
                  mails.add(email);    
         }         
         Messaging.sendEmail(mails);  
    }
   
   //Life Cycle method of Batch Class
    global void finish(Database.BatchableContext BC){
         
    }
}


While running this class, I got SINGLE_EMAIL_LIMIT_EXCEEDED error. How to Solve this issue please help me
I am looking to parse the below json response using Json deserializing

{
  "_total": 9,
  "values": [
    {
      "_key": "1050817",
      "group": {"id": "1050817"}
    }
  ]
}

The issue i am facing that I cannot declare a variable of name _total , it gives me an error saying no viable alternative at character '_' . Any idea how I can parse the above Json to get the value of total.
Hi,

I have a small issue regrading file preview in chatter. I uploaded a .docx file in chatter, when i open the file in chatter, it was showing no preview available, but it is working fine for pdf format files, I Enabled 'Enable Office 2007 previews in content' permission. Then also i am unable to preview, Is there any another permission to preview the file.

Please help me.
So I am trying to create my first batch class, and I am MORE THAN a little confused.  I created two classes.

<pre>
global class BatchUpdate_Financials implements Database.Batchable<sObject>
{
    global Database.QueryLocator start(Database.BatchableContext BC)
    {
        String query = 'SELECT Id,Name,status__c FROM Financial_Planning__c ';
        return Database.getQueryLocator(query);
    }

    global void execute(Database.BatchableContext BC, List<Financial_Planning__c> scope)
    {
        for (Financial_Planning__c fp : scope){

         if(fp.status__c == 'Active')
          update fp;

        }
    } 
    global void finish(Database.BatchableContext BC)
    {
    }
}
</pre>

<pre>
global class Scheduler_class implements Schedulable{

    public static String sched = '0 00 00 * * ?';  //Every Day at Midnight

    global static String scheduleMe() {
        Scheduler_class SC = new Scheduler_class();
        return System.schedule('My batch Job', sched, SC);
    }

    global void execute(SchedulableContext sc) {

        BatchUpdate_Financials fp = new BatchUpdate_Financials();
        ID batchprocessid = Database.executeBatch(fp,50);          
    }
}
</pre>

Then I read I have to type something like this in the Developer Console to actually schedule the job.

<pre>
Scheduler_class sch1 = New Scheduler_class();
String sch = '0 00 02 * * ?';
System.Schedulable('Financials Update', sch, sch1);
</pre>

But when i do, I get this error: "Method does not exist or incorrect signature: System.Schedulable(String, String, Scheduler_class)"

Any ideas what I am doing wrong?