function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
anil kumar devunoorianil kumar devunoori 

Why I am getting error when I execute below query?

Query in Developer Console:
select count() from RecordAction where ActionDefinition!=null

Error Message: 
An unexpected error occurred. Please include this ErrorId if you contact support: 1892670731-238612 (-1863376665)

When I execute same query in batch job, I got below error:
14:38:37.0 (11628419)|SYSTEM_METHOD_EXIT|[15]|BatchableContextImpl
14:38:37.0 (11636572)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:12
14:38:37.0 (11641144)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4
14:38:37.0 (11644929)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4
14:38:37.0 (11651159)|VARIABLE_SCOPE_BEGIN|[31]|this|Database.BatchableContextImpl|true|false
14:38:37.0 (11720780)|VARIABLE_ASSIGNMENT|[31]|this|{}|0x2d9895fe
14:38:37.0 (11727467)|VARIABLE_SCOPE_BEGIN|[31]|jobId|Id|false|false
14:38:37.0 (11833691)|VARIABLE_ASSIGNMENT|[31]|jobId|"7076g00000BKmtGAAT"
14:38:37.0 (11839995)|VARIABLE_SCOPE_BEGIN|[31]|childJobId|Id|false|false
14:38:37.0 (11861408)|VARIABLE_ASSIGNMENT|[31]|childJobId|"7076g00000BKmk3AAD"
14:38:37.0 (35565779)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:8
14:38:37.0 (178500415)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:8
14:38:37.0 (267469628)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:8
14:38:37.0 (353732986)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:8
14:38:37.0 (476538181)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:8
14:38:37.0 (564648158)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:8
14:38:37.0 (579395805)|FATAL_ERROR|Internal Salesforce.com Error


 
Best Answer chosen by anil kumar devunoori
Andrew GAndrew G
Hi

Most strange.  I can replicate the error which i don't understand as the same SOQL structure works for other objects.  
Playing in Dev Console, i found that the following seems to work though.

SELECT Count() FROM RecordAction WHERE ActionDefinition NOT IN (null)


Regards
Andrew

All Answers

Andrew GAndrew G
Hi

Most strange.  I can replicate the error which i don't understand as the same SOQL structure works for other objects.  
Playing in Dev Console, i found that the following seems to work though.

SELECT Count() FROM RecordAction WHERE ActionDefinition NOT IN (null)


Regards
Andrew
This was selected as the best answer
ManojjenaManojjena
HI Anil ,

As ActionDefinition in RecordAction  is a restricted picklist field having value (0,1,2-----18),means in query it will be treated as a string .String some times will not support Null and blank ,so try with blank string will help for sure .


SELECT Id FROM RecordAction WHERE ActionDefinition !=''

Let us know if it helps !!

Thanks ,
Manoj
anil kumar devunoorianil kumar devunoori
Hi Manojjena,

The query you gave is working fine. Thank you.
But this query should also work select count() from RecordAction where ActionDefinition!=null
, it is working on other picklist fields and and other data type fields.
I need this query working so I can use this generic query for all field types.
I am going to raise case with Salesforce

Thanks and Regards
Anil