I ran into this before and commented on a different thread - I think I may have tracked the issue down.

I generally add several name prefixes (e.g., Prof., Rev., Hon.) - it's possible that the Webform integration doesn't like that. I get the following in watchdog and the contact isn't created in Civi, nor does the Contact name appear in the webform submission.

This error is unpredictable and may be PHP-version related; in any event, this seems to (maddeningly) appear only on certain sites and not others.

The CiviCRM "contact create" API returned the error: "DB Error: constraint violation" when called by function "preSave" on line 143 of wf_crm_webform_postprocess.inc with parameters: "Array ( [contact_type] => Individual [contact_sub_type] => Array ( ) [webform_label] => Contact 1 [prefix_id] => 1 [first_name] => Test [last_name] => Testing [preferred_communication_method] => Array ( [0] => ) [source] => Join Us! [check_permissions] => [version] => 3 ) "

If I remove the Name Prefix field form the webform (or if there's a submission value of - None -), everything goes as expected. Perhaps this will be helpful should someone else run into the problem. Thanks!

Comments

bcobin created an issue. See original summary.

btc97’s picture

I'm getting the same error message, but for me the prefix is not involved, as I've reduced my webform to just first and last names!

The CiviCRM "contact create" API function returned the error: "DB Error: constraint violation" when called by line 589 of wf_crm_webform_postprocess.inc with the following parameters: "Array ( [contact_type] => Individual [contact_sub_type] => Array ( ) [webform_label] => Contact 1 [first_name] => Test [last_name] => Test [source] => Test [check_permissions] => [version] => 3 ) "

Using the API explorer there is no problem adding a new contact, with these (or whatever) parameters, so makes me think webform civicrm is involved. I can update existing contacts fine...

Using 7.x-4.12, webform 7.x-4.11, and CiviCRM 4.5.4.

mpaulson’s picture

Status: Active » Closed (outdated)

This issue was filed against a branch (7.x-4.x) that is no longer supported. We're sorry we did not get to work through it, but once you upgrade to 7.x-5.x and if the issue persists, please feel free to re-open.