Reputation: 11
I've created a webform that is outside of vTiger that I want to push into the database that vTiger uses.
This is the SQL code that pushes the data into the database:
$sql="INSERT INTO vtiger_potential(potentialname)VALUES('$company_name', '$potential_no')";
And this is the error that I seem to be getting:
Cannot add or update a child row: a foreign key constraint fails (`vtigercrm530/vtiger_potential`, CONSTRAINT `fk_1_vtiger_potential` FOREIGN KEY (`potentialid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE)
Any ideas on how to fix this?
Upvotes: 1
Views: 1932
Reputation: 3118
also you can add other inputs with corresponding names in Leads module. for custom fields you can check names by firebug (cf_*). 2. If you want to do it in database consider that all of the vtiger entities (contacts, leads, etc) has a specific id in crm_entity, so crm_entity holds all the ids of different entities. Before creating a lead entity, you must create its crm_entity row and then pass new_insert_id to Leads pertinent tables. But be careful in case of any future problem in crm you may not be sure it's your fault (direct manipulation of database) or not!
Upvotes: 1