I have a Drupal 7 node with custom fields. I have no problem setting values to the single text fields but I'm not sure how to set my select list field to one of the allowed keys of the field.
This is the code I've tried to assign the select list to the 'pending' key.
$node->field_referee_status['und'][0]['tid'] = 'pending';
Node creation code:
// CREATE NODE
$node = new stdClass;
$node->type = 'referee';
$node->title = 'Referee report for xx';
$node->uid = $user->uid;
$node->status = FALSE;
$node->field_referee_status['und'][0]['tid'] = 'pending';
$node->field_referee_id['und'][0]['value'] = 'test';
$node->field_testff['und'][0]['value'] = "testworked";
node_object_prepare($node);
node_save($node);
Question: Does anyone know the correct way to assign the key value to a custom select list field when creating Drupal nodes programmatically?