Hi i'm executing this query using
Database.Query(query)
Where query is
SELECT field1__c, field2__c, field3__c FROM Object1__c
On the current record, field3__c is NULL but when i query on the record instead of getting
"field1__c = value1", "field2__c = value2", "field3__c = null"
I get
"field1__c = value1", "field2__c = value2"
Just like the field has been deleted/not returned, which is a problem for our purpose.
The question is:
How can i get the null values returned as NULL or BLANK and not just "not returned"?
Best Answer
If you are checking in the debug logs, then that is how it will be displayed. It behaves the same for the normal
SOQL
query as well as for the dynamicSOQL
i.e. withDatabase.Query
So, if you perform a SOQL on
Object1__c
withfield3__c
asnull
, then the debug will always show youirrespective of whether you used normal
SOQL
orDatabase.Query
. If you want to add a null check forfield3__c
, then you can doIf you are passing this
field3__c
which to a flow i.e. a formula field, then you should have an additional check for related lookup field i.e. if your formula field's formula isAccount.AccountNumber
then have a check forAccountId != NULL && field3__c != NULL
in flow. If you try to directly accessfield3__c
or check forNULL
, it will give you error. So always have an additional check for its lookup field as first check and then check for its related field.