object-sync-for-salesforce icon indicating copy to clipboard operation
object-sync-for-salesforce copied to clipboard

New Wordpress object is not pushed to Salesforce if Salesforce user can create but can't edit records

Open jose-dvm opened this issue 1 year ago • 1 comments

Describe the bug

Hi, I was trying to setup a Leads push and I noticed that when using a Salesforce user who can create Leads but cannot edit them, the plugin doesn't push the new Wordpress record to Salesforce. Adding Edit permission to the user solves this, but it prevents to use a least privileges possible policy and results in a confusing UX.

To Reproduce Steps to reproduce the behavior:

  1. Create a Fieldmap to push some Wordpress object as Salesforce Leads using a Salesforce user who can create but not edit Leads. Probably Salesforce fields will be displayed as Locked.
  2. Create the Wordpress record
  3. Push won't be performed and a debug log will be created if this is setup

Expected behavior If the Salesforce user can create records, new Wordpress records should be pushed to Salesforce.

Screenshots

Screenshot of ignored push log:

imagen

Environment (please complete the following information):

  • WordPress Version: 6.4.5
  • PHP Version 7.4.33

Additional context

I think this is due to considering as locked / read-only fields those who are not updateable, even when they are createable. See this in Fiedmap page and the next one used in push class:

https://github.com/MinnPost/object-sync-for-salesforce/blob/9e4535ed567ca9d52dee340338eca4d8585a661c/templates/admin/fieldmaps-add-edit-clone.php#L310

https://github.com/MinnPost/object-sync-for-salesforce/blob/9e4535ed567ca9d52dee340338eca4d8585a661c/classes/class-object-sync-sf-mapping.php#L1096

jose-dvm avatar Sep 03 '24 11:09 jose-dvm

That is interesting. I'm not sure if that is the reason, but it's possible. No one is currently working on this plugin, but if there is a fix, it could be possible to implement. Do you have a sense of whether the Salesforce API has a method for detecting whether a field is createable?

jonathanstegall avatar Sep 04 '24 14:09 jonathanstegall

@jose-dvm I believe I've implemented a fix for this. I have a few other fixes I'm bundling together for a hopefully soon release.

jonathanstegall avatar Aug 03 '25 22:08 jonathanstegall

Fixed in #550.

jonathanstegall avatar Aug 03 '25 23:08 jonathanstegall

Whoa, thank you very much for this Jonathan, I will bear it in mind for future installations or updates.

Sorry for not providing additional feedback before, I really struggle to keep engaging in online conversations.

Greetings!

jose-dvm avatar Aug 07 '25 14:08 jose-dvm