I have a webform with CiviCRM fields on it (webform 7.x.4.1, civicrm_webform 7.x-4.9).
I have configured 2 addresses fieldset, one for work address and one for home address. I find it non intuitive to let the user choose the location for each address and set the first one as the primary. So i have instead defined one field that let the user choose which one is its primary address (simple select field with Home or Work value).
Now, i need to synchronize this with CiviCRM after the form is submitted. I use hook_webform_submission_insert and hook_webform_submission_update.
My question is : what is the best way to define which address is the primary for a contact (the address are already saved in the database). Api ? other ?
Alternative question : maybe there is another (more simple) way to do the same thing ?