I create a Custom Object named 'SomeTemplate__c'
with the Metadata API, and I have fields:
'created_at__c'
'name__c'
'template_id__c'
which are created with required: True
set in the parameters. Those fields appear in the describe response's 'fields'
field. These fields:
'updated_at__c'
'is_active__c'
'is_weighted__c'
do not have required
set in the parameters at all. Though these fields appear in the Object Manager UI for 'SomeTemplate__c'
's "Fields & Relationships" (so I know the Metadata API call succeeded for them), they do NOT appear in the desrcibe response's 'fields'
field, like the required
fields do.
Not only do they not show in that describe call, I also can't set those fields when inserting objects via the Bulk API. The insert call errors and tells me
Field name not found : is_active__c
So it feels like those fields weren't created (except that I can see them in the Salesforce website's Object Manager).
What is this weird behavior with required fields vs. non-required fields?
QUICK UPDATE:
I can update the visibility using the Salesforce website (Object Manager -> Field Accessibility) by checking the box for "Visible", under both "Field-Level Security" and "Page Layout". After doing that I can now see 'is_active__c'
in the describe call. But using the website is not a valid solution, since I need to do this via the API for many accounts, which I don't have dashboard access to since my API access for them is only via oAuth.
NOTE:
I can't simply make those fields required because 'updated_at__c'
is not always going to exist, and the others are of type 'Checkbox'
which, according to a different insert error message, cannot be required
.