MinnPost / object-sync-for-salesforce

WordPress plugin that maps and syncs data between Salesforce objects and WordPress objects.
https://wordpress.org/plugins/object-sync-for-salesforce/
GNU General Public License v2.0
94 stars 51 forks source link

Allow for bulk object maps to be created #98

Open jonathanstegall opened 7 years ago

jonathanstegall commented 7 years ago

The plugin currently does not create object maps for items that already exist in WordPress or Salesforce. That is, if you have an item in either system, updating it will not flag the plugin's triggers and create an object map.

If you create a new item after installing the plugin, it will trigger the plugin and all its future updates will as well.

I think there's room to build a feature to create object maps for existing data.

Data requirements

For this to work, we'd need to create a new row in the wp_object_sync_sf_object_map for each existing item we wanted to trigger the plugin.

We'd need to know:

  1. Type of WordPress object
  2. WordPress object ID

OR

  1. Salesforce ID

Each item would then go through the push or pull process, including any prematch fields that would check to see if they had a matching record already, for example by sharing an email address. We have a basic version of this already on the user profile page, where users can be manually pushed to Salesforce as a new record, or mapped to an individual Salesforce ID.

Interface requirements

We'd need a usable way to guide people through this, but essentially we need to gather one or more Salesforce IDs that user wants to bring into WordPress (either by mapping them to existing WordPress IDs or by creating new items in WordPress), or one or more WordPress IDs that user wants to bring into Salesforce (in the same way).

jonathanstegall commented 7 years ago

The Drupal 6 Salesforce module kind of had this, but it was crappy and unreliable. It was always easier to just manually add the rows to the database, but SQL is not a usable solution for this problem.

D6 did it like this. One time import:

image

This allowed the module to, at least theoretically, find all contacts that matched the conditions and import them into Drupal. I don't think it ever worked for us.

Import multiple IDs:

image

This one allowed you to paste multiple Salesforce IDs, pick an existing fieldmap (like user to contact) and the module would go through the process for each of those items. I don't remember if this worked, but we never used it.

When we first synced all our Salesforce Contacts to Drupal users if they had a match, we just did a big SQL insert that matched the module's database structure. So we had to look for all the matching users by email, associate them with Contact IDs, and create the table rows that way. This worked much better than the module, as it didn't result in API errors.

jonathanstegall commented 7 years ago

This need occurred to me when reading #97 although I don't know yet if this is what user is encountering. But either way I think this is a thing the plugin needs, eventually.

jonathanstegall commented 7 years ago

It's possible we also need to allow the plugin to run a checker every time any item from a mapped object in WordPress is updated, to see if it ought to be mapped to Salesforce. But I am unconvinced this is a good thing. Would need more thought about this.

jonathanstegall commented 7 years ago

I should note that the Drupal 7 version of this module doesn't appear to even attempt this functionality. Perhaps because it didn't work in D6 and is complicated, but I don't know. I'm also not aware of whether they added it to the D8 version, as that was not ready at least at the time we structured this plugin.

jonathanstegall commented 6 years ago

This is technically possible now with #153, which fixed #38. A user could make their own JSON that mapped objects together.

However that is absurd, and no one would do it, so this issue is not really done.

jonathanstegall commented 6 years ago

This is related to #182. This is a good place to find all the commits to add some documentation for import/export (#183). But this tracks the fuller issue as the interface is concerned.