vtiger Forum Index vtiger
The Honest Open Source CRM
 

Foreign Key Constraint Help?
Click here to go to the original topic

 
       vtiger Forum Index -> Developer Forum - 4.x
Previous topic :: Next topic  
Author Message
Guest






Posted: Wed Dec 28, 2005 2:48 am    Post subject: Foreign Key Constraint Help?  

Client has me adding products from an external ERP program -- do I can get all the necessary view's running okay -- but when I do the insert into the products table I get "foreign key constraint" errors.

I've got to have something out of order -- basically:

Get the next crmentity_seq for the product id -- get the current value, increment by 1

Insert into the crmentity table, and then into products -- where I get hammered.

Then I also cannot delete the now bad crmentity record -- again, foreign key constraint.....

Dan Means
SRS
Back to top  
dkmeans



Joined: 28 Nov 2005
Posts: 83
Location: Orange County, CA USA

Posted: Wed Dec 28, 2005 4:20 pm    Post subject: Re: Foreign Key Constraint Help?  

Any one?
Back to top  
Bushwack



Joined: 23 Aug 2005
Posts: 236

Posted: Wed Dec 28, 2005 4:50 pm    Post subject: Re: Foreign Key Constraint Help?  

Which foreign key is giving you the problem?

The productid in the products table must have a matching row in the crmentity table (ie: products.productid = crmentity.crmid).
Back to top  
dkmeans



Joined: 28 Nov 2005
Posts: 83
Location: Orange County, CA USA

Posted: Wed Dec 28, 2005 6:28 pm    Post subject: Re: Foreign Key Constraint Help?  

So, if I follow:

insert in this order:

crmentity
productcf
products
Back to top  
dkmeans



Joined: 28 Nov 2005
Posts: 83
Location: Orange County, CA USA

Posted: Wed Dec 28, 2005 6:49 pm    Post subject: Re: Foreign Key Constraint Help?  

It's productscf - custom fields that's failing.
Back to top  
Bushwack



Joined: 23 Aug 2005
Posts: 236

Posted: Wed Dec 28, 2005 7:13 pm    Post subject: Re: Foreign Key Constraint Help?  

You have to insert into products before productcf
Back to top  
 
       vtiger Forum Index -> Developer Forum - 4.x
Page 1 of 1


Powered by phpBB Search Engine Indexer
Powered by phpBB 2.0.15 © 2001, 2002 phpBB Group