Sreejit Posted March 30, 2012 Share Posted March 30, 2012 I have custom custom field named "documentId" for a product. When a client singup for a service and fills in this field, I want the domain name to be set to this "documentId" value. I tried do this using action hook PreModuleCreate http://docs.whmcs.com/Hooks:Products/Services#PreModuleCreate but te below code is not working. $vars['params']['domain'] = $vars['params']['customfields']['documentId']; Any idea what I am doing wrong? 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted March 30, 2012 Share Posted March 30, 2012 You will be best to use the "AfterModuleCreate" hook and then update the db directly like this update_query("tblhosting",array("domain"=>$vars['params']['customfields']['documentId']),array("id"=>$vars["params"]["serviceid"])); 0 Quote Link to comment Share on other sites More sharing options...
Sreejit Posted April 7, 2012 Author Share Posted April 7, 2012 Thanks Sparky, As per your suggestion, I used the below code in whmcsdir/includes/hooks/example.php but it' still not working. The domain field is still blank. I am using WHMCS Version: 5.0.3 function hook_updatedatanew($vars) { update_query("tblhosting",array("domain"=>$vars['params']['customfields']['documentId']),array("id"=>$vars["params"]["serviceid"])); } add_hook("AfterModuleCreate",1,"hook_updatedatanew"); 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.