- 🇩🇪Germany maacl
Likely duplicate of 🐛 On upsert: "Integrity constraint violation: 1062 Duplicate entry 'XXX' for key 'salesforce'" Needs work
We are using Drupal core contact forms, Salesforce suite module to submit leads from Drupal contact forms to Salesforce.
We have mapped one of the contact form fields to salesforce fields.
Every time, when we submit the contact form, it is creating new contact entity, Also submits the lead info to salesforce and creating new lead in salesforce.
If user submit the form with same email address multiple times, it's creating duplicate leads, instead we want to update the existing lead info in salesforce based on email. So Upsert key has been set as Email considering it will either create first time or update upon subsequent requests with same email. But it's not working, and throwing below db error.
Drupal\Core\Entity\EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'contact_to_leads_mapping-00Q2C000005MYMoUAO' for key 'sfid__mapping': INSERT INTO "salesforce_mapped_object" ("revision_id", "drupal_entity__target_id", "drupal_entity__target_type", "salesforce_mapping", "salesforce_id", "created", "changed", "entity_updated", "last_sync_status", "last_sync_action", "force_pull") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10); Array ( [:db_insert_placeholder_0] => [:db_insert_placeholder_1] => 83101 [:db_insert_placeholder_2] => contact_message [:db_insert_placeholder_3] => contact_to_leads_mapping [:db_insert_placeholder_4] => 00Q2C000005MYMoUAO [:db_insert_placeholder_5] => 1655392584 [:db_insert_placeholder_6] => 1655392584 [:db_insert_placeholder_7] => [:db_insert_placeholder_8] => 1 [:db_insert_placeholder_9] => push_upsert [:db_insert_placeholder_10] => ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save()
Configure Saleforce Mapping with contact form
Use Email as the Upsert key
Configure drupal to salesforce fields mapping including Email with Drupal to SF Direction.
Active
5.0
salesforce_push.module
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Likely duplicate of 🐛 On upsert: "Integrity constraint violation: 1062 Duplicate entry 'XXX' for key 'salesforce'" Needs work