• Resolved Sean

    (@twellve_million)


    Hi, thank you for this plugin. I’m still trying to figure out how it works though.

    One thing I’m currently having issue is, it seems that deleted WordPress object is not going to be created anymore. Despite that it’s Salesforce counterpart is still there.

    Here’s what happened.
    – setup plugin & auth
    – setup fieldmaps (pull from Salesforce only)
    – wp custom posts are created based on salesforce entry
    – deleted a wp custom post created by this plugin (say that it’s salesforce counterpart named x)
    – other custom posts created by the plugin is still having updated Salesforce content
    – x is no longer pulled to WordPress

    Can you please tell me why it’s happening this way? Could it be that I’m having the settings not setup right?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jonathan Stegall

    (@jonathanstegall)

    @twellve_million I think I understand the issue. Let’s see if this makes sense:

    • When you map individual objects to each other, the plugin creates an object map row (it has the WordPress and Salesforce IDs for each item).
    • When you delete an item in WordPress, IF the plugin has WordPress delete as one of its fieldmap settings, it will delete the object map. Same for Salesforce.
    • In your case, because your fieldmap is only doing pull from Salesforce operations, the plugin has not tracked that the WordPress post has been deleted. This means there’s still an object map row for that Salesforce ID. It’s likely that you would see error messages for the plugin trying to do things with that Salesforce data, if you check in the plugin logs.

    The plugin does not currently track operations that are outside its fieldmaps (so if there are no push methods checked, it doesn’t track when WordPress rows are created/updated/deleted). I can see how this could cause a problem like the one you’re describing. The plugin does have a Mapping Errors tab that lists object map rows that have errors when there are errors, and you can delete the object maps from that tab.

    I think that’s probably your best chance to address this issue for now, if there is a corresponding row in that tab. It’s possible we could account for this in the plugin in the future, but it feels like a potentially complicated situation we’d have to give some thought to.

    Thread Starter Sean

    (@twellve_million)

    Nice! So what I’ll need to do, is just somehow delete that relation row?

    Mapping Errors tab

    Where do I find this though? There’s only 6 tabs in the plugin page.
    Settings, Authorize, Fieldmaps, Scheduling, Import & Export, Log Settings.

    You’re right about the logs. Something weird though, it logs both success and error.

    
    56min Ago
    Error: WordPress update for equality_guide ID 27232 was unsuccessful with these errors:
    
    56min Ago
    Success: Update WordPress equality_guide with ID of 27232
    

    Those two posts in logs, are talking about the same post ID. I wonder why it’s triggering both success and error log?

    • This reply was modified 5 years, 11 months ago by Sean.
    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    @twellve_million hm, if you don’t have a mapping errors tab, the plugin assumes there are no rows that are broken. That probably just means that the deleted WordPress ID is still there, rather than it realizing the ID no longer exists.

    I’m not sure why it is adding an error and a success log. This needs further testing on the plugin side, clearly.

    If you have access to the database, you could look for the row manually. It’d be a query like:

    select * from wp_object_sync_sf_object_map where wordpress_id = 27232

    Then you could delete it manually and it should respond normally after that.

    I’ll give some thought to how this could be addressed in the plugin.

    Thread Starter Sean

    (@twellve_million)

    Sorry for the late reply, was involved in another issue.

    Yeah, that solved it. Manually going to database and clearing up entries in that table seems to solve the issue.

    Would be nice if we can do it via wp-admin though. Since setting a mapping object with no WordPress triggers will definitely cause this issue.

    Some of the entries in that table even have some kind of a string like WordPress ID (prefixed by tmp_). There’s no other way to fix this, other than going to the database table.

    Btw, I’m curious if we can manually triggers an object import, something like a button in a post edit page, that will import SalesForce object when it’s clicked. Which one of the plugin class is doing it?

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    Glad to hear it solved it. I’ll see if I can address these comments as well:

    1. I do agree it’d be nice. I don’t have any schedule for doing it at this time, but there is a GitHub issue. Happy to take pull requests!
    2. The plugin generates those temp IDs when it is waiting for a response. It replaces them when there’s a valid ID in the response. In this case, presumably it’s never getting a valid response because of the deletion, or because of some other lack of ID.
    3. The plugin does add a manual map creating functionality onto the user profile screen inside the admin. You might be able to expand this to also work on the post edit screen (but to be clear I’m not able to help with that at this time).
    4. There’s also some degree of REST API functionality built into the plugin that you could possibly use. You can read about that in the documentation. Otherwise there’s not currently a way to do what you’re looking for. But again, happy to take pull requests.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Deleting WordPress object breaks import’ is closed to new replies.