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
95 stars 51 forks source link

Fieldmap: list of WP fields isn't available when mapping to WP user on WP 6.0.1 #490

Closed amp42 closed 1 year ago

amp42 commented 2 years ago

Installed 2.2.2 a while ago on WP 6.0. Mapped WP user object to Salesforce User . Several other WP objects were mapped to other SF objects. Sync works, all is well.

Upgraded the plugin to 2.2.4, WP is now at 6.0.1. All fieldmaps but user are alive and well. On the Fieldmap tab the user fieldmap is active and there are rows for each WP->SF mapping but the name of the WP field in each row is blank. The pulldown menu that should contain WP field names has no entries. Attempting to add a new field mapping to this fieldmap doesn't help, the list of WP field names is still blank. Clearing the cache doesn't help.

Went to the database and had a look at the wp_2_object_sync_sf_field_map table. The user row in the table was still tagged with version 2.2.2 of the plugin whereas the other rows were at 2.2.4. Thinking this was an upgrade issue, I deleted the user row hoping to recreate the map on 2.2.4, .Unfortunately this didn't help. Yes, I can recreate the map but the WP field name list is still blank.

I was able to work around the issue by forcing the fields into the list via object_sync_for_salesforce_wordpress_object_fields hook. Thank you for having the hooks and documenting the format, truly a lifesaver! While this worked, it'd be nice to have the auto-generated list.

jonathanstegall commented 2 years ago

Are you able to do some debugging to find out why the plugin isn't able to load the list of user fields? I'd be especially interested in a few things:

  1. What version of PHP are you running?
  2. Does your server have any relevant errors in the logs?
  3. When you use that object_sync_for_salesforce_wordpress_object_fields, are you able to log the fields that the plugin recognizes before you use the filter? It would be something like this:
add_filter( 'object_sync_for_salesforce_wordpress_object_fields', 'your_function', 10, 2 );
function your_function( $object_fields, $wordpress_object ) {
error_log( print_r( $object_fields, true ) );
// do other code
return $object_fields;
}

In any case, I've certainly never seen the plugin do this, but my guess is that it's running into an error somewhere with the data it's seeing, and maybe we can compensate for that somehow.

amp42 commented 1 year ago

Couldn't repro this when I tried it again.