0

I created a dummy object TestObject__c and 1 number field with 2 records. 1st record is having some value and in 2nd no value. However, when I ran the system.debug for number field, the field doesn't even show up for 2nd record, I was expecting it to return at least 'null' value but field itself is not coming in system.debug. How to show up the field even for 'no value'?

0

try this debugging code in an Anonymous Apex window (from developer console its command+e or control+e). Additionally, replace YourNumberField__c with the api name of the number field that you alluded to.

List<TestObject__c> testObjList = new List<TestObject__c>([SELECT Id,Name,YourNumberField__c FROM TestObject__c])
System.debug('testObjList.size() is '+ testObjList.size());

for (TestObject__c record: testObjList){
System.debug('Id:'+record.Id + 'has number field value: '+record.YourNumberField__c);
}
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.