• Daniel K
  • NEWBIE
  • 40 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 22
    Replies
Hi All,
         I know this is popular error message, but I need to understand something about this error.

         I have an Apex Controller used in a vf page.
         This class has 4 SOQL queries.
        1) select id,name from object1__c where id=:ids --> 5000 records
        2) select id,name from object2__c where id =:ids --> 8000 records
        3) select id,name,(select id,name from object3_1__c ) from object3__c where id =:ids --> 2000 records
        4) select id,name from object4__c where id =:ids --> 8000 records

      From Debug logs, I could see below when a button is clicked, which inturn calling the Apex Class:

       Number of query rows: 32000 out of 50000

       
I read from the document that for sub-queries/ queries with parent child relationship, the record count would be 3 or more times the actual records returned. But, can I know how exactly this "Number of query rows" be calculated ?

Thanks.
Hi All,
           Mentioned Apex Batch Job has failed in "Preparing" state itself.

           Can you please help me in identifying potential cause for this error: 
            1) Is it during query execution  OR
            2) because of looping in the execute method ?

Thanks
D
Hi All,
            Noticed that after perparing and before processing,Total Batches field will be updated.

            Want to understand if preparing is the status where START method query is executed and 
            based on batch size total batches gets calculated ? All this happend during perparing state of batch job ?
            Can we understand if perparing is done means START method has completed successfully ?
            And BEGIN method won't start executing when status is perparing?

           Please comment on my above understandings.

Thanks
D
Hi All,
           Today I got "First Error: Apex CPU Limit Exceeded" error while executing batch apex.

            Not even a single batch got completed, below is the status of Apex Job.
            As it has failed in the first step itself, should we consider the failure is at START method ?       
Job Type	  Status	        Status Detail	                   Total Batches	Batches Processed	Failures	
 ----------   -------   -----------------------------------------  --------------   -----------------   --------
 Batch Apex	  Failed	First error: Apex CPU time limit exceeded       0	              1	                1

Thanks
 
Hi All,
          I have a subquery which I want to change to normal query:

SELECT Field1, Field2, (SELECT Name, Identifier__c FROM childObject__r Where type='some value') FROM Contact

          Can I know how can I do that ?

Thanks
Hi All,
          I have two object which are on master-detail relationship.
          Let's say Account(Master) and Contact(child).
          I understand that contact renders the permission from Account automatically.

          But, is there any way that I can set specific permissions for Contact object only ?
          I noticed that I can't have sharing rules, manual-sharing or queue to be created on child object.

Thanks
Hi All,
           How can I find all the user's who are assigned with a particular permission set ?
Hi All,
          I have two objects called product and product details. Product field is lookup on product details.
          In product details object, if I have a product detail record pd1 with product p1, I shouldn't be able to create or update 
          another product detail pd2 with product p1.
         
           How can I achieve this?
Hi All,
          I just want to understand if "Attempt to schedule too many concurrent batch jobs in this org" occurs in below scenario ?

          Let's say I have 2 schedulable batch jobs schedulbatch1 and scheulbatch2.
          Schedulebatch1 has 10 batch apex jobs and schedulebatch2 has 2 batch apex jobs.

          I will schedule schedulablebatch1 at 12 AM and schedulable batch2 at 1AM.
         
          During execution of schedulablebatch1, any chances that I get this error ? 
          Or,iff schedulablebatch1 is not finished before 1 AM and schedulablebatch2 starts execution will I get this error ?
                  
         I read that at a time not more than 5 batch apex jobs can be processed.
    
           global class schedulebat implements schedulablebatch1 {
                global void execute (schedulablecontext sc){
                    
                   batchapex1 bat1 = new batchapex1();
                   database.executable(bat1);

                   batchapex2 bat2 = new batchapex2();
                   database.executable(bat2);

                   batchapex3 bat3 = new batchapex3();
                   database.executable(bat3);

                   batchapex4 bat4 = new batchapex4();
                   database.executable(bat4);

                   batchapex5 bat5 = new batchapex5();
                   database.executable(bat5);

                   batchapex6 bat6 = new batchapex6();
                   database.executable(bat6);

                   batchapex7 bat7 = new batchapex7();
                   database.executable(bat7);

                   batchapex8 bat8 = new batchapex8();
                   database.executable(bat8);

                   batchapex9 bat9 = new batchapex9();
                   database.executable(bat9);

                   batchapex10 bat10 = new batchapex10();
                   database.executable(bat10);
}
}
Hi All,
         I have a scheduled apex job which executes everyday @1 AM.
          
         I want to execute batch apex b4 and b5 only after complete execution of b1,b2 and b3.
         How can I do this?
         
global class schedulebatch implements Schedulable {
   global void execute(SchedulableContext sc) {
   
 
    batchapex1 b1 = new batchapex1();
    Database.executeBatch(b1,200);

    batchapex2 b2 = new batchapex2();
    Database.executeBatch(b2,200);

    batchapex3 b3 = new batchapex3();
    Database.executeBatch(b3,200);

    batchapex4 b4 = new batchapex4();
    Database.executeBatch(b4,200);
    
    batchapex5 b5 = new batchapex5();
    Database.executeBatch(b5,200);    

   }
}

 
Hi,
      Please go through the below code once.

     start method query returns 200K reocrds
     execution method query returns 100K records

    Problem Description:
               If start method query returns 200K records and if I have batch size as 2K, my execute method runs 200 times.
               As I have another query in execute method, I hope it will be executed and processed 200 times as well.
               If the query in execute method runs and processes once, it should be fine for me.
               
               Is there any way to avoid this repetetion? Or I have to write a different batch apex to process  ?
               Also, can a query in execute method returns more than 50K records?
     
public class update_isTarget implements Database.Batchable<sObject>{
    public Database.queryLocator start(Database.BatchableContext bc){
        return Database.getQueryLocator('select id,ture_false__c from account where ture_false__c = true');
    }
    public void execute (Database.BatchableContext BC, List<account> accvals){
        List<Account> accountslist = new List<Account>([select id,ture_false__c from account where
                                                  id not in (select id from object2 where value__c='Y')
                                                  and ture_false__c = false]);

        for(Account a:accountslist){
         a.ture_false__c = true;
        }
		update accountslist;

        for(Account b:accvals){
            b.ture_false__c = false;
        }
        update accvals;
    }
    public void finish(Database.BatchableContext BC){
    }
}

Thanks for your time.
 
Hi All,
         I have two objects from where I have to compare Id field and update few fields on one of the objects.

         Let's say..
                   select field1 from object1 where condition=true  --> here i have 100k records

                   select field2 from object2 where condition = true  --> here I have 90k records

             Here, if field1=field2 then I have to update object1.field3='abc' ,object1.field4='xyz' and so on

             I think I can do this just by using List and Loop(haven't really tried though), but how to skip the governor limits of updating more than 50k records ?
               Please guide in solving this.
                Thanks.
Hi All,
            On Contact page I have a link(formula field with hyperlink), when ever I click on this link, I should clear value of department field and should save automatically.
              Any simpler way to perform this.

Thanks.
Hi All,
            I have created a formula field with hyperlink and when clicked on that it opens vfpage in same tab.
          
            Now, when I select something from vfpage I want to return to the main page(not custom vfpage).

            If anyone know pls suggest.

Thanks.
Hi,
     I have a standard Product page with few fields but here we talk about two fields: 
     1.Formula field with hyperlink to open vfpage on same tab.
     2.Text field to hold Product name

     Now, when I click on formula's hyperlink, a vf page should open and through that vfpage I should search for particular product and select one.
     When I select product from vfpage, the text field in standard page should be filled with the product name.

     What is the ideal way to do this without having JS in formula field's hyperlink ?

Thanks in Advance.
Hi, 
   I have Account(parent) object and custom(child) object C1.
   I'm trying to concatenate all values of a text(tf1) field of C1 object and assign to a text custom(Acctf1) field in Account object.
   
   Let's say..
    Account          Custom Object(tf1 values)
    --------         -------------
    Account1         cs1
                            cs2
                            cs3
                            cs4
    
    Account2         cs5
                            cs6
                            cs7
              
    Now, for Account1 value, Acctf1 field should have cs1:cs2:cs3:cs4
             for Account2 value, Acctf1 field should have cs5:cs6:cs7

 As I couldn't do it through configuration, can you suggest how to code it ?
Thanks.
Hi All,
          I just want to understand if "Attempt to schedule too many concurrent batch jobs in this org" occurs in below scenario ?

          Let's say I have 2 schedulable batch jobs schedulbatch1 and scheulbatch2.
          Schedulebatch1 has 10 batch apex jobs and schedulebatch2 has 2 batch apex jobs.

          I will schedule schedulablebatch1 at 12 AM and schedulable batch2 at 1AM.
         
          During execution of schedulablebatch1, any chances that I get this error ? 
          Or,iff schedulablebatch1 is not finished before 1 AM and schedulablebatch2 starts execution will I get this error ?
                  
         I read that at a time not more than 5 batch apex jobs can be processed.
    
           global class schedulebat implements schedulablebatch1 {
                global void execute (schedulablecontext sc){
                    
                   batchapex1 bat1 = new batchapex1();
                   database.executable(bat1);

                   batchapex2 bat2 = new batchapex2();
                   database.executable(bat2);

                   batchapex3 bat3 = new batchapex3();
                   database.executable(bat3);

                   batchapex4 bat4 = new batchapex4();
                   database.executable(bat4);

                   batchapex5 bat5 = new batchapex5();
                   database.executable(bat5);

                   batchapex6 bat6 = new batchapex6();
                   database.executable(bat6);

                   batchapex7 bat7 = new batchapex7();
                   database.executable(bat7);

                   batchapex8 bat8 = new batchapex8();
                   database.executable(bat8);

                   batchapex9 bat9 = new batchapex9();
                   database.executable(bat9);

                   batchapex10 bat10 = new batchapex10();
                   database.executable(bat10);
}
}
Hi All,
           Mentioned Apex Batch Job has failed in "Preparing" state itself.

           Can you please help me in identifying potential cause for this error: 
            1) Is it during query execution  OR
            2) because of looping in the execute method ?

Thanks
D
Hi All,
            Noticed that after perparing and before processing,Total Batches field will be updated.

            Want to understand if preparing is the status where START method query is executed and 
            based on batch size total batches gets calculated ? All this happend during perparing state of batch job ?
            Can we understand if perparing is done means START method has completed successfully ?
            And BEGIN method won't start executing when status is perparing?

           Please comment on my above understandings.

Thanks
D
Hi All,
           Today I got "First Error: Apex CPU Limit Exceeded" error while executing batch apex.

            Not even a single batch got completed, below is the status of Apex Job.
            As it has failed in the first step itself, should we consider the failure is at START method ?       
Job Type	  Status	        Status Detail	                   Total Batches	Batches Processed	Failures	
 ----------   -------   -----------------------------------------  --------------   -----------------   --------
 Batch Apex	  Failed	First error: Apex CPU time limit exceeded       0	              1	                1

Thanks
 
Hi All,
           How can I find all the user's who are assigned with a particular permission set ?
Hi All,
          I have two objects called product and product details. Product field is lookup on product details.
          In product details object, if I have a product detail record pd1 with product p1, I shouldn't be able to create or update 
          another product detail pd2 with product p1.
         
           How can I achieve this?
Hi All,
         I have a scheduled apex job which executes everyday @1 AM.
          
         I want to execute batch apex b4 and b5 only after complete execution of b1,b2 and b3.
         How can I do this?
         
global class schedulebatch implements Schedulable {
   global void execute(SchedulableContext sc) {
   
 
    batchapex1 b1 = new batchapex1();
    Database.executeBatch(b1,200);

    batchapex2 b2 = new batchapex2();
    Database.executeBatch(b2,200);

    batchapex3 b3 = new batchapex3();
    Database.executeBatch(b3,200);

    batchapex4 b4 = new batchapex4();
    Database.executeBatch(b4,200);
    
    batchapex5 b5 = new batchapex5();
    Database.executeBatch(b5,200);    

   }
}

 
Hi,
      Please go through the below code once.

     start method query returns 200K reocrds
     execution method query returns 100K records

    Problem Description:
               If start method query returns 200K records and if I have batch size as 2K, my execute method runs 200 times.
               As I have another query in execute method, I hope it will be executed and processed 200 times as well.
               If the query in execute method runs and processes once, it should be fine for me.
               
               Is there any way to avoid this repetetion? Or I have to write a different batch apex to process  ?
               Also, can a query in execute method returns more than 50K records?
     
public class update_isTarget implements Database.Batchable<sObject>{
    public Database.queryLocator start(Database.BatchableContext bc){
        return Database.getQueryLocator('select id,ture_false__c from account where ture_false__c = true');
    }
    public void execute (Database.BatchableContext BC, List<account> accvals){
        List<Account> accountslist = new List<Account>([select id,ture_false__c from account where
                                                  id not in (select id from object2 where value__c='Y')
                                                  and ture_false__c = false]);

        for(Account a:accountslist){
         a.ture_false__c = true;
        }
		update accountslist;

        for(Account b:accvals){
            b.ture_false__c = false;
        }
        update accvals;
    }
    public void finish(Database.BatchableContext BC){
    }
}

Thanks for your time.
 
Hi All,
         I have two objects from where I have to compare Id field and update few fields on one of the objects.

         Let's say..
                   select field1 from object1 where condition=true  --> here i have 100k records

                   select field2 from object2 where condition = true  --> here I have 90k records

             Here, if field1=field2 then I have to update object1.field3='abc' ,object1.field4='xyz' and so on

             I think I can do this just by using List and Loop(haven't really tried though), but how to skip the governor limits of updating more than 50k records ?
               Please guide in solving this.
                Thanks.
Hi All,
            I have created a formula field with hyperlink and when clicked on that it opens vfpage in same tab.
          
            Now, when I select something from vfpage I want to return to the main page(not custom vfpage).

            If anyone know pls suggest.

Thanks.
Hi,
     I have a standard Product page with few fields but here we talk about two fields: 
     1.Formula field with hyperlink to open vfpage on same tab.
     2.Text field to hold Product name

     Now, when I click on formula's hyperlink, a vf page should open and through that vfpage I should search for particular product and select one.
     When I select product from vfpage, the text field in standard page should be filled with the product name.

     What is the ideal way to do this without having JS in formula field's hyperlink ?

Thanks in Advance.