• Resolved Tim Nolte

    (@tnolte)


    I want to ensure that the WordPress Post ID is populated to Salesforce after a successful Salesforce Pull. I’d like to simply PATCH the Saleforce object with the WordPress Post ID in the field that has been created there. Is that possible using the api_call method with a ‘PATCH’ method?

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

    (@jonathanstegall)

    I’m sure it is possible, but I wouldn’t provide support for that here. I think you’re right, in your previous issue, that the plugin shouldn’t need that but I have not had a chance to look into it to see if I can reproduce it.

    If you’re comfortable writing this level of code, you may want to do some logging to see why the plugin is not finding the object map that has the Salesforce ID first.

    Thread Starter Tim Nolte

    (@tnolte)

    @jonathanstegall perhaps I’m not setting my Prematch & Salesforce Key options properly in my field mapping. I’ve created a custom Salesforce ID field in WordPress that I’m mapping the Salesforce record ID to, however I can see that this sort of seem redundant since the object mapping table also contains this mapping. Another thing that is interesting is that I can see a Salesforce object map box when viewing a WordPress User, that I have setup as a mapping to Salesforce Contacts. However, I don’t ever see this Salesforce Mapping box populated on my Custom Post Types, which is why I’ve manually added these custom fields.

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    @tnolte there might be two different issues here, so I’ll see if I can speak to both of them.

    1. you’re right, you shouldn’t put the ID into a custom field. It might be a problem that it isn’t working, I’m not really sure about that and you might need to do more logging to find out why it isn’t, but it’s definitely not necessary since the object map connects the post ID and the Salesforce record ID. If there is a problem, it might be because WordPress doesn’t create custom fields (or any meta fields) until the object has already been created. I don’t think that would keep it from using a custom field as a prematch field; I think I’ve tested this in the past, but I’m not positive. So it would be good to learn more about this.
    2. There is indeed an object map box on the WordPress user edit screen, but there isn’t one on any other object types. There is not much intentionality to this, it’s unfortunately just because the user screen is the main one that isn’t potentially affected by external factors (Gutenberg, for example). There’s a longstanding GitHub issue to make a box for other object types. I’d happily review pull requests for a box on other WordPress objects, but I don’t have a current plan to work on that.

    Thread Starter Tim Nolte

    (@tnolte)

    @jonathanstegall so right now I’m setting my prematch key to the WordPress Post ID mapping, and setting the Salesforce Key to the Salesforce ID custom field mapping. Should I be removing both of those options completely?

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    @tnolte I think so. I would try removing the prematch and the Salesforce Key settings. You can still save the Salesforce ID to that custom field if you want, if it’s useful for display or anything like that, but as far as I can tell you shouldn’t have to use it in that way if it’s only to prevent duplicates.

    Thread Starter Tim Nolte

    (@tnolte)

    @jonathanstegall OK, I just tested by removing both of those settings, deleting the WP post records & deleting the mapping object records and I’m getting a duplicate created in WordPress. Is there some sort of cached version of the field mapping that I need to clear out? If I am changing values in the pull params would this be causing an issue? I’m not doing anything with the Salesforce ID but I’m fixing Taxonomy values related to Salesforce pick lists.

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    @tnolte yes, there is a clear cache button on the plugin settings, on the Fieldmaps screen. You should click that button if you haven’t already. Otherwise, I think there needs to be some logging to find out why it isn’t realizing the object is already mapped. For a place to start, here’s the code where the plugin checks to see if there’s a mapping object with a Salesforce ID.

    Thread Starter Tim Nolte

    (@tnolte)

    I was able to resolve this by simplify the matching criteria.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Possible to PATCH a Salesforce Object with 1 Attribute using api_call?’ is closed to new replies.