• Resolved jayeshvariyani

    (@jayeshvariyani)


    Hi,

    Thanks very much for the awesome plugin. I am able to push the drop down fields from WP to SFDC successfully.

    However my requirement is to create a Post in WP which is having drop down field of Country ( for Example ). Now I am trying to Pull this field from Salesforce – where the same field is there of Picklist data type. But nothing is populated in WP.

    There is no error log. The same case is there for the Date type fields also. Please help me.

    Thanks in Advance,
    Jayesh

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

    (@jonathanstegall)

    There’s not a lot I can go on here. First, I would make sure you have cleared the plugin cache. That is always a good place to start.

    Aside from that, sometimes this kind of thing happens with a permissions issues – the user authenticated with the WordPress plugin cannot see the values from Salesforce, for example.

    If it isn’t that, it could also be formatting. If you have a WordPress field that expects data in a certain format but Salesforce stores it in another format, there can be problems. We do provide ample developer hooks in this plugin that you could possibly use to address this, but I can’t offer much more than that.

    Thread Starter jayeshvariyani

    (@jayeshvariyani)

    Hi Jonathan,

    Thanks for the quick response, Yes I think it’s a formatting issue as I tried to pull the same field into normal text field in WordPress and was able to pull successfully.

    1) Could you please advise which developer hooks will be helpful for this requirement, as I am completely new to PHP so your advise will be the direction for me to start on the perfect place..

    2) Also if you can tell me the flow how the Salesforce pull is handled by the plugin, that would be great help.

    Will wait for your response,

    Thanks,
    Jayesh

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    We do have a lot of documentation about this. You can read about how the pull process works here.

    There’s also documentation about modifying Salesforce data before it is saved in WordPress. You can read that here.

    We don’t provide support for the developer hooks, to be clear. But here’s a basic example of something you could try.

    
    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 ) {
    	foreach ( $params as $key => $values ) {
    		if ( 'datefieldname' === $key ) {
    			// convert the Salesforce date to a timestamp, then format it to match your desired WordPress date format
    			$params[ $key ]['value'] = date( 'Y-m-d', strtotime( $values['value'] ) );
    		}
    	}
    
    	return $params;
    	
    }
    

    What this would do, basically, is loop through all of your mapped fields. If it found one where the name matched your Salesforce date field’s API name, it would convert the value into a PHP date before trying to store it in WordPress.

    You could do the same with any mapped field, if you know the name that comes from Salesforce, and you know what format WordPress expects it to be in.

    You would store this code either in a separate WP plugin you would create, or in your theme’s functions.php file. But again, this is beyond the scope of the kind of support we can provide.

    Thread Starter jayeshvariyani

    (@jayeshvariyani)

    Thank you so much for the support, I was able to use the developer hooks you stated and was able to complete my requirement.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Not able to Pull Picklist Fields’ is closed to new replies.