How to programmatically set a custom field?
Use the Entity module wrapper. 


  The entity API provides some wrapper classes you may use to easily deal with entities and to leverage the entity property information modules provided. With the help of the wrappers you can access the property information, loop over known properties, or just get/set the described data values, etc.


Install the Entity module and do something like:

$user = user_load($GLOBALS['user']-&gt;uid);
$obj = entity_metadata_wrapper('user', $user);
$obj-&gt;field_custom = $lead_id;
$obj-&gt;save();


$GLOBALS is http://php.net/manual/en/reserved.variables.globals.php