I've been trying to update a custom field metadata, specifically - update the valueSet.restricted to false to eliminate the restriction.
I already tried many different ways, adding or removing fields to the request body, the response error clearly says Only the Metadata and FullName fields may be specified on CustomFieldDefinition
so I am only sending Metadata or these 2 together. I made sure FullName has the Object.field format, including the __c for custom field.
Whatever I do, I keep getting either this when sending the minimal request (object with only Metadata.restricted field, regardless of whether FullName is in the body or not):
{
"message": "Could not resolve standard field's name.",
"errorCode": "FIELD_INTEGRITY_EXCEPTION",
"fields": []
}
I read somewhere I need to send the full Metadata object, which is quite large and then I got this error instead:
{
"message": "Cannot deserialize instance of complexvalue from VALUE_NULL value null or request may be missing a required field",
"errorCode": "JSON_PARSER_ERROR"
}
This is the HTTP request I'm sending (as well as without the FullName field):
curl https://xxx.salesforce.com/services/data/v62.0/tooling/sobjects/CustomField/00N3... -X PATCH -H 'Content-Type: application/json' -d '{"FullName": "Contact.Field1__c","Metadata":{"valueSet":{"restricted":false}}}'
I even tried this approach described here to use POST with a query parameter to indicate patch, but it still gives the same response.
Help? Anybody knows how to overcome this? I'm hoping this is possible with the Tooling API and I'm just missing something like required fields or something, but the null error throws me off whenever I'm trying to experiment with adding/removing fields to the valueSet object.
Thanks in advance.