Some fields that are stored as id references to other tables can be set by simply passing the value as an id, e.g. setting gender_id=Male works.
I have a custom fieldset attached to contacts that includes a country (of origin - it's different to of residence!) field, known affectionately as custom_77
.
But I've noticed that the API doesn't like me to pass custom_77=Uganda
- it complains that Uganda is not an integer. Can't fault it there :-)
My answer to the setting gender question provides a working solution: you can get it from getIdForLabel('contact', 'custom_77', 'Uganda')
, or from any other country field, e.g. getIdForLabel('address', 'country_id', 'Uganda')
, but as that turned out to be a very long winded solution when it was actually very simple, I thought I might, once again, be wrong! Hence this question.