
And adding custom field code is the following (simplified):
CustomField field = new CustomField();
field.setType(FieldType.Text);
field.setDescription(description);
field.setLabel("answerid");
field.setFullName("answerid__c");
field.setLength(lenght);
customObject.setFields(new CustomField[] {field});
UpsertResult[] results = metadataConnection.upsertMetadata(new Metadata[]{ customObject });
It returns a success result, and as I commented, I able to see the field in the tool, however, I cannot use the field when creating instances of the custom object, and it does not show up in the REST API "describe" resource of my custom object.
Is there something I am missing ??1 件の回答
It will likely be field level security (https://developer.salesforce.com/docs/atlas.en-us.securityImplGuide.meta/securityImplGuide/admin_fls.htm). While the profile of the user can create the field, they can't then access it for queries.