Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7680723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:10:51+00:00 2026-05-31T18:10:51+00:00

I have created a task in my org with subject Email Task i have

  • 0

I have created a task in my org with subject “Email Task”

i have written apex code as

public class  TaskInfoDAOClass
{
   public static List<Task> queryTaskInfo ()
    {
integer count = [SELECT count() FROM Task];
System.debug('Row Count :'+ count);
 List<Task> tasks= [SELECT Task.Id,Task.AccountId,Task.Status,Task.Account.Name FROM Task where Task.Subject='Email Task'];
  return tasks;     
  }
}

I have created one test class to test apex code as

@isTest 
public class TestTaskInfoDAO
{
 public static testMethod void testQueryTaskInfo()
 {
List<Task> tasks = TaskInfoDAOClass.queryTaskInfo();
 System.debug ('this is a debug statement');

for (Task t : tasks)
{
 System.debug ('Status '+ t.Status);
  System.debug ('Account name '+ t.Account.Name);

 }
}
} 

when I run this test I am getting 0 as ROW count. please refer apex.log file

24.0 APEX_CODE,FINE;APEX_PROFILING,FINE;DB,INFO;VALIDATION,INFO;WORKFLOW,FINEST
23:48:30.100 (100678000)|EXECUTION_STARTED
23:48:30.100 (100722000)|CODE_UNIT_STARTED|[EXTERNAL]|01p90000000k5Qw|TestTaskInfoDAO.testQueryTaskInfo
23:48:30.101 (101272000)|METHOD_ENTRY|[2]|01p90000000k5Qw|TestTaskInfoDAO.TestTaskInfoDAO()
23:48:30.101 (101414000)|METHOD_EXIT|[2]|TestTaskInfoDAO
23:48:30.101 (101494000)|METHOD_ENTRY|[1]|01p90000000k5Qr|TaskInfoDAOClass.TaskInfoDAOClass()
23:48:30.101 (101513000)|METHOD_EXIT|[1]|TaskInfoDAOClass
23:48:30.101 (101782000)|METHOD_ENTRY|[6]|01p90000000k5Qr|TaskInfoDAOClass.queryTaskInfo()
23:48:30.102 (102176000)|SOQL_EXECUTE_BEGIN|[5]|Aggregations:0|select count() from Task
23:48:30.106 (106893000)|SOQL_EXECUTE_END|[5]|Rows:0
23:48:30.106 (106965000)|SYSTEM_METHOD_ENTRY|[6]|String.valueOf(Object)
23:48:30.107 (107012000)|SYSTEM_METHOD_EXIT|[6]|String.valueOf(Object)
23:48:30.107 (107032000)|SYSTEM_METHOD_ENTRY|[6]|System.debug(ANY)
23:48:30.107 (107040000)|USER_DEBUG|[6]|DEBUG|Row Count :0
23:48:30.107 (107047000)|SYSTEM_METHOD_EXIT|[6]|System.debug(ANY)
23:48:30.107 (107385000)|SOQL_EXECUTE_BEGIN|[9]|Aggregations:0|select Task.Id, Task.AccountId, Task.Status, Task.Account.Name from Task where Task.Subject = 'Email Task'
23:48:30.109 (109847000)|SOQL_EXECUTE_END|[9]|Rows:0
23:48:30.109 (109930000)|METHOD_EXIT|[6]|01p90000000k5Qr|TaskInfoDAOClass.queryTaskInfo()
23:48:30.110 (110074000)|USER_DEBUG|[7]|DEBUG|this is a debug statement
23:48:30.789 (111361000)|CUMULATIVE_LIMIT_USAGE
23:48:30.789|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 2 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Number of script statements: 7 out of 200000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of fields describes: 0 out of 100
  Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
  Number of picklist describes: 0 out of 100
  Number of future calls: 0 out of 10

23:48:30.789|TOTAL_EMAIL_RECIPIENTS_QUEUED|0
23:48:30.789|STATIC_VARIABLE_LIST|
  double:MAX_VALUE:0
  long:serialVersionUID:0
    int:MAX_EXPONENT:0
    int:MIN_EXPONENT:0
    Boolean:TRUE:0
    long:serialVersionUID:0
    double:POSITIVE_INFINITY:0
    double:MIN_NORMAL:0
    double:MIN_VALUE:0
    Boolean:FALSE:0
    int:SIZE:0
    char[]:DigitOnes:0
    int[]:sizeTable:0
    char[]:DigitTens:0
    double:NaN:0
    int:MAX_VALUE:0
    char[]:digits:0
    long:serialVersionUID:0
    double:NEGATIVE_INFINITY:0
    int:MIN_VALUE:0
    int:SIZE:0

23:48:30.789|CUMULATIVE_LIMIT_USAGE_END

23:48:30.111 (111444000)|CODE_UNIT_FINISHED|TestTaskInfoDAO.testQueryTaskInfo
23:48:30.111 (111452000)|EXECUTION_FINISHED
23:48:30.999|CUMULATIVE_PROFILING_BEGIN
23:48:30.999|CUMULATIVE_PROFILING|SOQL operations|
  Class.TaskInfoDAOClass.queryTaskInfo: line 5, column 1: [SELECT count() FROM Task]: executed 1 time in 5 ms
  Class.TaskInfoDAOClass.queryTaskInfo: line 9, column 1: [SELECT Task.Id,Task.AccountId,Task.Status,Task.Account.Name FROM Task where Task.Subject='Email Task']: executed 1 time in 3 ms

23:48:30.999|CUMULATIVE_PROFILING|No profiling information for SOSL operations
23:48:30.999|CUMULATIVE_PROFILING|No profiling information for DML operations
23:48:30.999|CUMULATIVE_PROFILING|method invocations|
  External entry point: public static testMethod void testQueryTaskInfo(): executed 1 time in 11 ms
  Class.TestTaskInfoDAO.testQueryTaskInfo: line 6, column 1: public static LIST<Task> queryTaskInfo(): executed 1 time in 8 ms
  Class.TestTaskInfoDAO.testQueryTaskInfo: line 9, column 1: global object iterator(): executed 2 times in 1 ms
  Class.TaskInfoDAOClass.queryTaskInfo: line 6, column 1: global public static String valueOf(Object): executed 2 times in 0 ms
  Class.TestTaskInfoDAO.testQueryTaskInfo: line 7, column 1: global public static void debug(ANY): executed 1 time in 0 ms

23:48:30.999|CUMULATIVE_PROFILING_END

Why I am getting 0 ROW COUNT ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T18:10:52+00:00Added an answer on May 31, 2026 at 6:10 pm

    This is because as of Spring 2012, the data will not be in the org during testing and must be recreated from your test methods unless you use the IsTest(SeeAllData=true) annotation. From the Apex manual:

    Starting with Apex code saved using Salesforce API version 24.0 and
    later, test methods don’t have access by default to pre-existing data
    in the organization, such as standard objects, custom objects, and
    custom settings data, and can only access data that they create.

    You must create test data for each test. You can disable this
    restriction by annotating your test class or test method with the
    IsTest(SeeAllData=true) annotation. For more information, see
    IsTest(SeeAllData=true) Annotation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a task for MSBuild that is to be used by developers
I have a script task that executes a dynamically created SQL restore statement. This
I have an application and every new created activity will start an async task
I have created an async task and want to change the message of progress
i have run a code snippet from Gradle Cookbook apply plugin: 'java' task create-dirs
I have created a task in Symfony 1.4 that loads in some CSV files
I have created a custom Ant task as per one of my previous posts
The task: I am trying to create a custom data type and have it
I have created the following C library for reading an image: typedef struct {
I have created a skin for DotNetNuke 5.x and I attempted to do as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.