• Resolved amddtim

    (@amddtim)


    I’m pulling from Salesforce to WordPress, not pushing changes in reverse. I had it working to some extent, but wanted to clear out all my WordPress posts and start over pulling from Salesforce and creating new posts. But in deleting the posts on the WordPress end, it seems like the plugin is still trying to link Salesforce objects to old, deleted WordPress post id’s. Should I have not deleted them?

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

    (@jonathanstegall)

    Well, a pull should successfully delete records in WordPress when they are deleted in Salesforce, if the delete trigger is checked on the fieldmap, but otherwise a deletion doesn’t do anything.

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    Also, please close your other issue if you have resolved it.

    Thread Starter amddtim

    (@amddtim)

    Sorry, maybe I wasn’t clear (or I’m not understanding what you’re saying), but I deleted the posts on the WordPress side, not the Salesforce side. Basically, I wanted to start with a new import, but the original Salesforce objects didn’t change. But having deleted the WordPress posts, it seems like Salesforce, having mapped to the ids with a key, doesn’t realize the WordPress posts don’t exist.

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    That’s correct. If you had the WordPress delete trigger checked, it would have deleted the items in Salesforce when you deleted them in WordPress (so that is a push event). Otherwise it doesn’t do anything upon a WordPress delete.

    Thread Starter amddtim

    (@amddtim)

    Right, but I’m not trying to do an actual sync to Salesforce, I just want to pull. So if Salesforce creates a post in WordPress, and then I delete that post, you’re saying the plugin won’t ever recreate that post when the object gets updated in Salesforce?

    How do I reset the mapping/connection?

    • This reply was modified 7 years ago by amddtim.
    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    Yes. Updating an item in Salesforce does not trigger a create in WordPress by default, since create and update are not the same action. However you could change that with a hook:

    
    add_filter( 'object_sync_for_salesforce_pull_object_allowed', 'allow_pull', 10, 5 );
    // can always reduce this number if all the arguments are not necessary
    function allow_pull( $pull_allowed, $object_type, $object, $sf_sync_trigger, $salesforce_mapping ) {
    	if ( 'something' ) {
    		return true; // if this event is true, an item will be pulled into WordPress
    	}
    }
    

    You’d want to think a little carefully about what kind of conditional to use there, I think, but it would be doable.

    Thread Starter amddtim

    (@amddtim)

    I don’t really plan to delete the WordPress objects again in the future, so would there be a way, perhaps in the database, to delete all the ‘pull from Salesforce’ relationships? That filter might be heavy-handed for me in the long run.

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    You can do a list of all the rows with this: select * from wp_object_sync_sf_object_map; (assuming wp_ is your table prefix) and then you could delete the ones you don’t want. It saves the last action, pull or push, and it could be either, but you could possibly figure out what you need that way.

    Thread Starter amddtim

    (@amddtim)

    Great. Let me take a peek and let you know.

    Thread Starter amddtim

    (@amddtim)

    Okay, deleting those rows is what I needed. Thanks!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Clear Salesforce Sync’ is closed to new replies.