Can’t map multiple WordPress objects to the same Salesforce object
-
The unique key constraint on salesforce_id in the object_map table prevents mapping more than one WordPress object (e.g., user, shop_order) to the same Salesforce object (e.g., Contact). I need this functionality so I can update SF Contact records with data stored in two different WP objects. What are the ramifications of removing that unique key constraint — or would it require extensive customization to achieve what I describe below?
SF Contacts are initially created outside of the OSfS plugin (using Zapier webhooks). The Contact record contains a field with WordPress ID (populated with the corresponding WP user ID when created).
Fieldmaps:
1. Sync WP user addresses with corresponding SF Contact mailing addresses:
WP object: user
SF object: Contact
Trigger on WP or SF update, sync both directions
Prematch: WP user.ID : SF WordPress ID.2. Push the shipment tracking number for a customer order (stored in the ‘shop_order’ custom post’s meta data) to the corresponding SF Contact record.
WP object: shop_order
SF object: Contact
Trigger on WP update, sync WP-to-SF only
Prematch: WP ‘_customer_user’ postmeta field (same as user ID) : SF WordPress IDEach fieldmap works as expected when running alone. But the unique key constraint on salesforce_id prevents both fieldmaps from working together — only one mapping can be stored and subsequently executed.
I didn’t see this restriction mentioned in the documentation (though it’s clear from looking at the schema). Moreover, the Fieldmaps tab’s ‘Weight’ section says: ‘Weight is intended for use when you have multiple fieldmaps for the same object, either in WordPress or Salesforce.’
Many thanks for the great (and well documented) plugin, and for any guidance you can provide.
- The topic ‘Can’t map multiple WordPress objects to the same Salesforce object’ is closed to new replies.