3 deleted 7 characters in body
source | link

Any field (including custom fields) that accepts an option value will take either its machine name or it's id. The machine names for countries are their ISO codes, e.g. the code for 'United States' is 'US'. So you could do:

civicrm_api3('Contact', 'create', array(
  'custom_77' => 'US',
));

which is equivalent to

civicrm_api3('Contact', 'create', array(
  'custom_77' => 1228,
));

The label "United States""Uganda" will not work, as it's not considered reliable given translations and word-replacements.

To find the ISO code for a country, use the api explorer. Api Country get with name = Uganda reveals "iso_code": "UG"

Any field (including custom fields) that accepts an option value will take either its machine name or it's id. The machine names for countries are their ISO codes, e.g. the code for 'United States' is 'US'. So you could do:

civicrm_api3('Contact', 'create', array(
  'custom_77' => 'US',
));

which is equivalent to

civicrm_api3('Contact', 'create', array(
  'custom_77' => 1228,
));

The label "United States" will not work, as it's not considered reliable given translations and word-replacements.

To find the ISO code for a country, use the api explorer. Api Country get with name = Uganda reveals "iso_code": "UG"

Any field (including custom fields) that accepts an option value will take either its machine name or it's id. The machine names for countries are their ISO codes, e.g. the code for 'United States' is 'US'. So you could do:

civicrm_api3('Contact', 'create', array(
  'custom_77' => 'US',
));

which is equivalent to

civicrm_api3('Contact', 'create', array(
  'custom_77' => 1228,
));

The label "Uganda" will not work, as it's not considered reliable given translations and word-replacements.

To find the ISO code for a country, use the api explorer. Api Country get with name = Uganda reveals "iso_code": "UG"

2 added 129 characters in body
source | link

Any field (including custom fields) that accepts an option value will take either its machine name or it's id. The machine names for countries are their ISO codes, e.g. the code for 'United States' is 'US'. So you could do:

civicrm_api3('Contact', 'create', array(
  'custom_77' => 'US',
));

which is equivalent to

civicrm_api3('Contact', 'create', array(
  'custom_77' => 1228,
));

The label "United States" will not work, as it's not considered reliable given translations and word-replacements.

To find the ISO code for a country, use the api explorer. Api Country get with name = Uganda reveals "iso_code": "UG"

Any field (including custom fields) that accepts an option value will take either its machine name or it's id. The machine names for countries are their ISO codes, e.g. the code for 'United States' is 'US'. So you could do:

civicrm_api3('Contact', 'create', array(
  'custom_77' => 'US',
));

which is equivalent to

civicrm_api3('Contact', 'create', array(
  'custom_77' => 1228,
));

The label "United States" will not work, as it's not considered reliable given translations and word-replacements.

Any field (including custom fields) that accepts an option value will take either its machine name or it's id. The machine names for countries are their ISO codes, e.g. the code for 'United States' is 'US'. So you could do:

civicrm_api3('Contact', 'create', array(
  'custom_77' => 'US',
));

which is equivalent to

civicrm_api3('Contact', 'create', array(
  'custom_77' => 1228,
));

The label "United States" will not work, as it's not considered reliable given translations and word-replacements.

To find the ISO code for a country, use the api explorer. Api Country get with name = Uganda reveals "iso_code": "UG"

1
source | link

Any field (including custom fields) that accepts an option value will take either its machine name or it's id. The machine names for countries are their ISO codes, e.g. the code for 'United States' is 'US'. So you could do:

civicrm_api3('Contact', 'create', array(
  'custom_77' => 'US',
));

which is equivalent to

civicrm_api3('Contact', 'create', array(
  'custom_77' => 1228,
));

The label "United States" will not work, as it's not considered reliable given translations and word-replacements.