• Resolved kocosh

    (@kocosh)


    Hi guys,

    I’m looking for an elegant way of postponing the push of certain object, until some criteria are met…

    Is there any object_sync_for_salesforce_push_object_allowed equivalent, that wouldn’t flag the object forever? I’d like to assess the criteria each time the object is updated. Any ideas?

    Thanks a lot! ??

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

    (@jonathanstegall)

    I think if I’m understanding you correctly, you could still use the object_sync_for_salesforce_push_object_allowed filter.

    Here’s an example of how I have used it:

    
    add_filter( 'object_sync_for_salesforce_push_object_allowed', 'my_push_not_allowed', 10, 5 );
    function push_not_allowed( $push_allowed, $object_type, $object, $sf_sync_trigger, $mapping ) {
    	if ( 'user' === $object_type && 1 === $object['ID'] ) { // do not add user 1 to salesforce
    		return false;
    	}
    }
    

    I wanted to keep the user with ID of 1 from being pushed to Salesforce. Of course the user ID doesn’t change, but if I were checking for a different object attribute (email, first name, etc.) the plugin would check each time. Return false keeps it from pushing, and return true allows it to push. True is also the default return here.

    Does that help, or am I missing what you’re looking to do?

    Thread Starter kocosh

    (@kocosh)

    Oh, that’s fast ??

    That does indeed help, thank you!

    In that case I just misunderstood the docs, I thought it would skip certain object permanently… sorry.

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    Looking at it I’m realizing that the docs on that pair of hooks is really bad. I’ll try to fix that before next release.

    But these hooks do run on every push/pull, so I think it will work for you. I’ll try to clarify that as well.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Prevent push to SF temporarily’ is closed to new replies.