Is there a way to make APIv4 validate options when creating/updating?
For example, using the demo data I can run:
$ cv api4 Contact.update '{"where":[["id","=",202]],"values":{"constituent_information.Marital_Status":"Junk"}}'
and then verify the update took place with:
$ cv api4 Contact.get '{"select":["constituent_information.Marital_Status"],"where":[["id","=",202]]}'
producing:
[
{
"id": 202,
"constituent_information.Marital_Status": "Junk"
}
]
So Marital_Status
is set to Junk
- even though that is not a valid option. When viewing this in the UI the field now shows as blank.
I could use getfields
to get the valid options and check them before doing the API call but an option (or default behaviour) on the API call to produce some sort of error or warning would be useful.