• Resolved gijungkim

    (@gijungkim)


    Hi,

    I am trying to map a quiz score field that is being written to a table (in wordpress) and push to the Enrollment History (User Salesforce Object) in Salesforce. I have tried looking through the documentation, and it is a bit confusing how I would go about this?

    Thank you for the help.

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

    (@jonathanstegall)

    @gijungkim well, what have you tried already? Would be happy to update the documentation to be more clear (and we gladly accept pull requests), but I’m not sure this is actually a support request.

    In general, though, here’s how this plugin works works:

    1. You can have one WordPress object type that can map to one Salesforce object type. So if the User is the object in Salesforce, you need a corresponding object in WordPress.
    2. You can map individual fields to each other on each object. So if Enrollment History is a Salesforce field, you need to determine what field can load it in WordPress.
    3. If the WordPress field is a meta field, it has to have at least one value in it before the plugin can see it. This is because meta fields don’t technically exist in WordPress until they have values.
    4. You can determine whether the value should only come from Salesforce to WordPress, only come from WordPress to Salesforce, or sync every time either changes.
    5. You can set a schedule for how often the plugin should run.

    WordPress has many ways of creating custom fields, and this plugin doesn’t necessarily work with all of them, but this is the basic idea of how it works.

    Thread Starter gijungkim

    (@gijungkim)

    Hi Jonathan,

    I guess what the workflow I am trying to do is.

    Quiz plugin writes to a specific database table in WP with a score tied to a user id. What I can’t seem to do is to find that field in the WP Object Users. Everything is fine from the Salesforce side, I am able to link that completely fine. I am just a bit confused on the WP bit. There is an existing value in the database table for quiz score.

    • This reply was modified 5 years, 1 month ago by gijungkim.
    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    Are you saying you have a custom quiz score field on the user object in WordPress? If so, is it stored in the wp_usermeta table? If it is, have you cleared the plugin cache?

    Usually, the plugin is able to load user meta fields as long as they’re added in standard WordPress ways. If not, it may be a method that the plugin doesn’t support. There are a lot of ways of adding custom fields, and this plugin doesn’t really support non-standard ways.

    Thread Starter gijungkim

    (@gijungkim)

    I’m not necessarily sure if it is on the user object itself. In the quiz database table, it has a reference to the ID that is listed in wp_users. I don’t see any value in the wp_usermeta table.

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    Okay. So the quiz table is a separate table. You won’t be able to do that with this plugin without writing some code, since this is not a standard way of storing data in WordPress. There are lots of developer hooks in this plugin though, and it’s possible you could do this with one of those. We don’t really provide support for them, beyond keeping the documentation up to date.

    Thread Starter gijungkim

    (@gijungkim)

    Yep. Do you have any suggestions or recommendations then? I am familiar with writing php code, but just not as familiar with WordPress. Or is there another plugin that you recommend for such a task.

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    Well, you can certainly try out the developer hooks and see what happens if you have a local site. I am pretty confident you could do what you mention with them. We would be thrilled to link to whatever you create in this plugin’s documentation for developer hooks, if it works well.

    There’s a lot of external documentation out there about when and how to use developer hooks in WordPress, generally. This Smashing Magazine article is a decent example.

    Beyond that, we have links to a few other choices that can be used to sync Salesforce and WordPress in the readme for this plugin. I don’t personally have experience with any of them, so I can’t say whether you could do what you’re looking to do with them.

    Thread Starter gijungkim

    (@gijungkim)

    Hey Jonathan, I’ve been attempting to modify the developer hook. Could you explain this part of the webhook object_sync_for_salesforce_create_custom_wordpress_item so that I understand it properly.

    function add_object( $create_data ) {
    // $create_data is array( ‘name’ => objecttype, ‘params’ => array_of_params, ‘id_field’ => idfield )
    // run methods here to add the record to the database
    // save the result as $result
    }

    My understanding is that the add_object takes in a parameter (array) of 3 inputs. What does it mean by adding the record to the database if this is creating a WP object? I have code written elsewhere that updates a table that I want to utilize in mapping a custom WP object.

    Ultimately, I am trying to achieve either adding the contents of another table to the User object or creating a brand new WP object that has the contents of that other table.

    • This reply was modified 4 years, 10 months ago by gijungkim.
    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    Like I said earlier, we don’t really provide support for the developer hooks, beyond keeping the documentation up to date. You should start by working with them locally. If you’re not sure what a parameter is, do an error_log with its value and see what it’s doing. And we’ll certainly accept pull requests if you’d like to expand the documentation. But aside from that, I really can’t offer you much.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Mapping database table to Salesforce Object’ is closed to new replies.