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
Petr Částek 3Petr Částek 3 

Schema.SObjectType.Contact.fields.getMap() returns smaller map than expected.

Hi,
I have a managed package that I'm developing. In the developer org the above expression returns:
- normal result counting more than 61 fields when ran in anonymous execution mode
- sooner 0, now 1 field only when ran from tests as well as from batch job (apex)
Why? I need all the fields to be accessible in batch job or tests.
I found that API restriction might be the limiting factor. But my package has no possibility to set its restrictions:

Package settings without possibility to set its restrictions.
Scott Haleo 4Scott Haleo 4
Hi Petr,

You can verify field level security on Contact fields first.

Then let me know again any issues.

Regards,
Scott Haleo
@Hytechpro.com