Title: syncing issues
Last modified: September 2, 2021

---

# syncing issues

 *  [peteratomic](https://wordpress.org/support/users/peteratomic/)
 * (@peteratomic)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/syncing-issues-4/)
 * Trying to sync Assets in SF to our website. Having very inconsistent results.
 * We have some custom fields in SF, mapped to ACF fields in a custom post type.
 * When doing an update in one of those fields in SF, I have the corresponding post
   open in my browser. I wait for the cron job to run, refresh the post and can 
   see the new text. However, it won’t show up on the page with the post query… 
   in fact, this change isn’t visible UNTIL I manually click save.
 * Is this an issue with having the post open in “edit” mode? NO. Tested again, 
   changing the text in the SF Asset. This time, the post disappears from the post
   query page (the “link to the page” in this ticket) altogether. I look in the 
   custom posts, find the asset, open it up and can see the imported text that I
   just changed… BUT even thou it is marked as Published, its not. If I manually
   click UPDATE, then the post is “actually” published and then visible again.
 * So does this plugin use some method that sets everything back to draft, even 
   if its not visible as a draft? This makes zero sense.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fsyncing-issues-4%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/syncing-issues-4/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/syncing-issues-4/page/2/?output_format=md)

 *  Thread Starter [peteratomic](https://wordpress.org/support/users/peteratomic/)
 * (@peteratomic)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/syncing-issues-4/#post-14831526)
 * P.S. There’s budget for this if custom investigation and solutions are required,
   we could likely hire your team to solve this.
 *  Plugin Author [Jonathan Stegall](https://wordpress.org/support/users/jonathanstegall/)
 * (@jonathanstegall)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/syncing-issues-4/#post-14831794)
 * First, I don’t guarantee ACF support in this plugin, although I’ve tried to support
   it whenever possible. Beyond that:
 * 1. I can say that this plugin doesn’t convert published posts back to drafts.
   At least I’ve never seen it do that.
    2. To me this sounds like a data cache 
   issue. You might have some kind of server side caching (redis, memcache, etc.)
   that runs on your server, and it may be that it gets cleared when a post is updated
   but not when this plugin runs its operations. If that is the case, you might 
   be able to use one of the developer hooks to clear the cache after the plugin
   successfully saves data from Salesforce. 3. If that isn’t the case, I think you
   may want to see if you can reproduce this in a local environment (presumably 
   with a sandbox).
 * PS there isn’t really a team that consistently works on this plugin at MinnPost(
   or anywhere else), it’s just me.
 *  Thread Starter [peteratomic](https://wordpress.org/support/users/peteratomic/)
 * (@peteratomic)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/syncing-issues-4/#post-14832281)
 * Thanks for the quick reply [@jonathanstegall](https://wordpress.org/support/users/jonathanstegall/)!
 * 1. Its not actually switching from “published” to “draft” in the classic WP sense,
   but in terms of it being visible or not via post query
 * 2. we don’t have any caching system in place, so does that make it sound like
   its an ACF problem? That your plugin could be importing data from SF, where it“
   almost” is saved into an ACF field, but then isn’t visible until manually published?
 * 3. will see if someone on our team can do that.
 * Finally, if its just you… are you available for hire to help solve these issues?
 *  Plugin Author [Jonathan Stegall](https://wordpress.org/support/users/jonathanstegall/)
 * (@jonathanstegall)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/syncing-issues-4/#post-14832844)
 * If it’s not a cache, I think it’s possible that there is some kind of intermediate
   state. It would be good to know what that is, if it’s new to ACF and if it’s 
   a consistent behavior that this plugin needs to account for.
 * I think if you can get a local setup (or if you have database access you could
   just inspect the database wherever it is), you should check the database to see
   what is happening with the relevant fields before the post gets published, and
   then compare it to the values for those fields that are in the database after
   it gets published. ACF creates several fields for a record, if I recall correctly,
   so it may be that something is missing in the middle.
 * I’m not currently available to hire, but that’s where I would start.
 *  Thread Starter [peteratomic](https://wordpress.org/support/users/peteratomic/)
 * (@peteratomic)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/syncing-issues-4/#post-14851209)
 * Did another round of testing with debugging turned on and got these errors:
 * > [08-Sep-2021 13:57:35 UTC] PHP Notice: Trying to get property ‘ID’ of non-object
   > in /www/htdocs/w01a2ea9/sanktoberholz.de/wp-includes/class-wp-query.php on 
   > line 4044
   >  [08-Sep-2021 13:57:35 UTC] PHP Notice: Trying to get property ‘post_title’
   > of non-object in /www/htdocs/w01a2ea9/sanktoberholz.de/wp-includes/class-wp-
   > query.php on line 4046 [08-Sep-2021 13:57:35 UTC] PHP Notice: Trying to get
   > property ‘post_name’ of non-object in /www/htdocs/w01a2ea9/sanktoberholz.de/
   > wp-includes/class-wp-query.php on line 4048
 * This happened in this intermediate state, where I change content in SF, it appears
   in the ACF field in the back-end post editor, but then the post disappears from
   the post query.
 * That provide any useful clues?
 *  Plugin Author [Jonathan Stegall](https://wordpress.org/support/users/jonathanstegall/)
 * (@jonathanstegall)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/syncing-issues-4/#post-14851255)
 * Well at that stage, the plugin is trying to use the core WordPress methods for
   dealing with posts so it’s hard to be sure. But my guess is that it’s trying 
   to modify a post that hasn’t loaded or doesn’t exist.
 * I think at this stage you really need to reproduce this in a local environment
   so you can do your own debugging, or hire someone else who can do that kind of
   work.
 *  Thread Starter [peteratomic](https://wordpress.org/support/users/peteratomic/)
 * (@peteratomic)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/syncing-issues-4/#post-14869769)
 * Still trying to debug. ACF support said:
 * > If you don’t find the updated data then the import could be a draft post. In
   > this case the data could be attached to a different post ID and this post ID
   > will be a child post of the real post ID. You can look for this by looking 
   > for posts where the post_parent is the real post ID.
 * After frustrating attempts to find the postmeta tables for the existing post 
   IDs, I decided to try deleting all of the imported assets and just start over.
 * Now I can’t even sync anything. Turned on logging and got this:
 *     ```
       Error: WordPress update for assets ID 21960 from Salesforce record 02i5I0000049jPsQAI was unsuccessful with these errors:
   
       Errors from WordPress result:
   
       WP_Error Object
       (
       [errors] => Array
       (
       [invalid_post] => Array
       (
       [0] => Invalid post ID.
       )
   
       )
   
       [error_data] => Array
       (
       )
   
       [additional_data:protected] => Array
       (
       )
   
       )
       ```
   
 * So the plugin seems to be permanently mapping SF assets to posts that are gone,
   with no way to reset that? Only thing I can find in the settings that seems remotely
   close is “Prevent Duplicate Field Mapping?” but that’s not checked. Any ideas
   so I can start over?
 *  Plugin Author [Jonathan Stegall](https://wordpress.org/support/users/jonathanstegall/)
 * (@jonathanstegall)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/syncing-issues-4/#post-14870710)
 * Currently, the plugin does not have a way to delete object maps unless the fieldmap
   is configured to delete records. That is, on the Action Triggers, you can check
   the “WordPress Delete” and “Salesforce Delete” boxes. That is 1) maybe not what
   you want, and 2) not helpful for things that have already been deleted.
 * I do have an [issue on GitHub](https://github.com/MinnPost/object-sync-for-salesforce/issues/261)
   to figure out what to do with object maps that correspond to deleted records.
   Would welcome pull requests if you want to work on that, but currently the only
   way to keep that from happening is to delete the rows from the wp_object_sync_sf_object_map
   table. You can do that manually, or you can uninstall the plugin with the “Delete
   Plugin Data on Uninstall?” box checked, and then reinstall it. It’s probably 
   worth doing that if you’re starting over.
 *  Thread Starter [peteratomic](https://wordpress.org/support/users/peteratomic/)
 * (@peteratomic)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/syncing-issues-4/#post-14889429)
 * Hi [@jonathanstegall](https://wordpress.org/support/users/jonathanstegall/) tried
   to backup, disable and delete but not really sure where that worked. Does your
   setting to delete all data work in multisite contexts? Soon as I deleted, I reinstalled
   and the odd thing is that I saw the salesforce keys already before importing.
   There were also two posts from days ago that instantly reappeared after re-installing,
   which seemed odd.
 * So far nothing is importing after 10 minutes or so, which led to me wonder if
   multisite is somehow interfering with the delete process.
 *  Plugin Author [Jonathan Stegall](https://wordpress.org/support/users/jonathanstegall/)
 * (@jonathanstegall)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/syncing-issues-4/#post-14889477)
 * I’m not sure, actually. I’ve certainly never done any work for this plugin to
   work in multisite and I don’t think I’d claim that it’s supported.
 * I’d be open to accepting any multisite specific pull requests, in any case.
 *  Thread Starter [peteratomic](https://wordpress.org/support/users/peteratomic/)
 * (@peteratomic)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/syncing-issues-4/#post-14889619)
 * Assumed it was the multisite thing, so I went ahead and deleted the object_sync_sf_object_map
   table and am now seeing the last two edits syncing.
 * I can see both of those newly synced posts in the database in wp_posts. Both 
   marked there and in WP backend as published. I can also see all of the data from
   SF in the postmeta table in my ACF fields, as well as in the backend when editing
   the post.
 * And yet, even with all of this, nothing is “live” until I manually click UPDATE.
 * Next I try to make a text change in SF and rather than updating the existing 
   post, a new one is created rather than updating the existing post.
 * So… any ideas from the above info?
 *  Plugin Author [Jonathan Stegall](https://wordpress.org/support/users/jonathanstegall/)
 * (@jonathanstegall)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/syncing-issues-4/#post-14889665)
 * I think like I said a couple weeks ago, you need to inspect the wp_posts and 
   wp_postmeta tables before you click update, and then do it again after you click
   update. Literally, do an export of those tables and find out what is different.
   You might want to use a diff tool if the tables are large, and then you can find
   out exactly what values are not the same. I would also look at wp_options though,
   in case you do have some kind of transient that is not being cleared until you
   click update. And again, do it both before and after you click update; that’s
   how you need to determine what is changing when you click the button.
 * This is definitely a data issue, but it’s not clear to me whether it’s different
   data that is saved at different times, or when some amount of cached data is 
   cleared, or something else, but I do think that is the kind of work you need 
   to do.
 *  Thread Starter [peteratomic](https://wordpress.org/support/users/peteratomic/)
 * (@peteratomic)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/syncing-issues-4/#post-14892692)
 * Ok, downloading the data tables to test as you describe.
 * But what about this new issue of a second post being created, rather than the
   plugin editing the existing one? Thought you had it designed that it was locked
   in place that one asset in SF was assigned to a single post, which is why I couldn’t
   update after deleting all the posts.
 * Tested again and another minor edit is creating an additional post, leaving us
   with three versions of the same item. I have “pull to drafts” selected: “If selected,
   WordPress will check for matches against existing drafts of this object type,
   and will also update existing drafts.” That’s clearly not happening. Would seem
   that this issue needs to be resolved, as there’s no way to check what’s happening
   with edits on an existing post when new ones are being created every time.
 *  Thread Starter [peteratomic](https://wordpress.org/support/users/peteratomic/)
 * (@peteratomic)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/syncing-issues-4/#post-14892825)
 * Tried unchecking the “pull to drafts” setting, as I remembered that I used one
   of the snippets in our functions file for automatically saving as published and
   may not have had that setting checked as a result. However, it didn’t matter 
   as its still creating an additional post with every edit.
 *  Thread Starter [peteratomic](https://wordpress.org/support/users/peteratomic/)
 * (@peteratomic)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/syncing-issues-4/#post-14892831)
 * Here’s the snippet in case that’s relevant:
 *     ```
       // syncing data from salesforce -- changes default to publish
       add_filter( 'object_sync_for_salesforce_pull_params_modify', 'change_pull_params', 10, 6 );
       function change_pull_params( $params, $mapping, $object, $sf_sync_trigger, $use_soap, $is_new ) {
       	$params['post_status'] = array(
       		'value' => 'publish',
       		'method_modify' => 'wp_update_post',
       		'method_read' => 'get_post',
       	);
       	return $params;
       }
       ```
   

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/syncing-issues-4/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/syncing-issues-4/page/2/?output_format=md)

The topic ‘syncing issues’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/object-sync-for-salesforce.svg)
 * [Object Sync for Salesforce](https://wordpress.org/plugins/object-sync-for-salesforce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/object-sync-for-salesforce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/object-sync-for-salesforce/)
 * [Active Topics](https://wordpress.org/support/plugin/object-sync-for-salesforce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/object-sync-for-salesforce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/object-sync-for-salesforce/reviews/)

 * 16 replies
 * 2 participants
 * Last reply from: [Jonathan Stegall](https://wordpress.org/support/users/jonathanstegall/)
 * Last activity: [4 years, 8 months ago](https://wordpress.org/support/topic/syncing-issues-4/page/2/#post-14894393)
 * Status: not resolved