• Resolved Nicolas

    (@nchaccal)


    Hi Jonathan, hope don’t bother you so much :/

    I want to know if you can guide me with this situation.

    I have a registration form in my WordPress that send the user form data to an user object in SalesForce. That works great!

    But inside this register form in wordpress, i have an additional data (attachment files) that have to be send to a relationated object inside the user object in SalesForce.This mean that both objects have the same id in Salesforce.

    I tried to do it with the mapping fieldtab just like with the user form. But wass no luck.

    I think i have to hook the moment before when wordpress send the data to SalesForce and add these files. But not sure if this is the way.

    Can you give me some advice with this?

    Thanks! And sorry again for bother you with these questions :/

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

    (@jonathanstegall)

    I can’t really give you advice on this. It’s not something that is built into the plugin. You certainly could do this with the plugin’s developer hooks if you have a lot of PHP skill. But again I cannot offer support with this.

    Thread Starter Nicolas

    (@nchaccal)

    Hi Jonathan. Understood. No problem.

    Im trying with the custom hooks and i have a question with one. The object_sync_for_Salesforce_push_object_allowed

    I put this in my function.php with the id of the user i dont want to be pushed to Salesforce but always get pushed to salesforce. I tried change the object. Instead of id, put an first_name, last_name to try, but not luck.

    add_filter( 'object_sync_for_salesforce_push_object_allowed', 'check_user', 10, 5 );
    // can always reduce this number if all the arguments are not necessary
    function check_user( $push_allowed, $object_type, $object, $sf_sync_trigger, $mapping ) {
    	if ( $object_type === 'user' && $object['Id'] === 1 ) {
    		$push_allowed = false;
    	}
    	return $push_allowed;
    }

    Let me know. Thanks!

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    I think it is probably because you have $object['Id'] when the wp_users table uses ID. Salesforce uses Id but WordPress does not, and you’re trying to prevent a WordPress user from being pushed.

    If that isn’t the case, try doing some error logging to see what is happening. For example, you can use error_log( print_r( $object, true ) ); to see what the structure of the object is.

    Thread Starter Nicolas

    (@nchaccal)

    You are absolute right, as usual with the plugin, Jonathan!

    Btw. This code comes from the github documentation. In the push hook says Id for wp_object.

    https://github.com/MinnPost/object-sync-for-salesforce/blob/master/docs/extending-sync-allowed.md

    Thanks again for all your help!

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    You’re right, thanks. I updated that on GitHub. I’m not sure when the next plugin release will happen, but it will update there as well at that time.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘how to send additional objects inside an object with id’ is closed to new replies.