I am using database.query to extract records. I am passing a query from the front end.The query can be anything.
But I am not getting the records properly in return.
For example, if I am passing the below query:
String query = 'SELECT fax FROM Account LIMIT 5';
Sobject[] objData = Database.query(query);
system.debug('myData::'+objData);
On debug I am getting this:
(
Account:{Fax=905-882-5801, Id=0013000000BcUfoAAF},
Account:{Fax=415-683-2349, Id=0013000000BcUfpAAF},
Account:{Id=0013000000BcUfqAAF},
Account:{Fax=+61-292-417954, Id=0013000000BcUfrAAF},
Account:{Fax=408-588-1296, Id=0013000000BcUfsAAF}
)
As you can see, the third record does not have Fax column inside. I need it to be like this: Account:{Fax=null, Id=0013000000BcUfqAAF}
How to acheive that? Can it be done using something else other than Database.query. I want max 50,000 records.
Best Answer
The field is there, but it's not being printed out by default. If you try
you will get the null value as well. So for your intents, all the data is in place.