-1

I just added a new field to a custom Salesforce Object. I now want to query that field from the database. If I query it from the developer console, everything is fine. However... If I query it from Apex no results are found:

[SELECT Id, MyNewString__c FROM FitTips__c]

returns an array of Ids

Here's what the log looks like (I set everything to finest)

12:36:41.0 (122674445)|HEAP_ALLOCATE|[53]|Bytes:4
12:36:41.0 (122898600)|SOQL_EXECUTE_BEGIN|[53]|Aggregations:0|SELECT Id, MyNewString__c FROM FitTips__c
12:36:41.0 (122983672)|LIMIT_USAGE|[53]|SOQL|3|100
12:36:41.0 (123006941)|LIMIT_USAGE|[53]|AGGS|1|300
12:36:41.0 (133779067)|SOQL_EXECUTE_END|[53]|Rows:696
12:36:41.0 (133803337)|LIMIT_USAGE|[53]|SOQL_ROWS|1392|50000
12:36:41.0 (133842485)|HEAP_ALLOCATE|[53]|Bytes:2788
12:36:41.0 (134466866)|HEAP_ALLOCATE|[53]|Bytes:20273
12:36:41.0 (134510654)|HEAP_ALLOCATE|[53]|Bytes:2788

I've never added a custom field before, did I miss something?

7
  • I don't see a problem here?
    – sfdcfox
    Aug 21, 2019 at 20:01
  • [SELECT Id, MyNewString__c FROM FitTips__c] returns an array of Ids @sfdcfox
    – FBuser
    Aug 21, 2019 at 20:15
  • also, if I query [SELECT Id, MyNewString__c,a,b,c,d,e FROM FitTips__c] I get an array of [id,a,b,c,d,e]
    – FBuser
    Aug 21, 2019 at 20:16
  • Do you have the profile permission to view the field?
    – Aayush K
    Aug 21, 2019 at 20:30
  • @AayushK Good question, I looked at other fields and I can't find anything that makes the permissions differ. Looked all over the object manager and my permissionset list.
    – FBuser
    Aug 21, 2019 at 20:36

1 Answer 1

0

Ok, no idea what went wrong, but this time I created the new field from the object manager and everything is fine.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .