• Resolved esowers2

    (@esowers2)


    Is there a way to have object sync for SF automatically populate the salesforce ID of a newly created SF record on the wordpress post that triggered the event?

    We send new WP posts to salesforce and it creates a new SF record, however we’d like to immediately place that SF ID back on a field of the original WP post.

    We have a work around of automatically triggering an update of the record in salesforce which will push an update back down, but that solution has to wait until the next time the action scheduler runs in order to get the value.

    It’d be super helpful if it could do that on the original record creation. Especially if it could populate the SF ID in an ACF field (though I know you don’t support ACF fields officially).

    Thanks.

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

    (@jonathanstegall)

    I do think you could do this with one of the developer hooks. I’m inclined to think object_sync_for_salesforce_push_success would be the best one. There’s a bit of documentation about it, but I think I can offer a basic (untested) guess at what you could do. I put it into a gist.

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    Thinking over it, you might want to do a check to make sure that it only happens when the operation is create. But the hook does include that information, so you could add that in as an if statement before doing the save.

    Thread Starter esowers2

    (@esowers2)

    Awesome.

    We did run into a small snag which in our use case doesn’t really matter. If the WP record is manually entered through the gui, then the object sync hook hits before it runs the publish event. Therefore the field gets populated with the SF ID, however, it then immediately gets overwritten by the blank value from the save process (when you click the publish button). Like I said, in our case it’s not an issue because we’re programmatically creating those records from forms so it doesn’t overwrite the value in that process.

    This anomaly could totally be something in our own setup too.

    Its working great though, thanks for the help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WP to SF object record id’ is closed to new replies.