New Wordpress object is not pushed to Salesforce if Salesforce user can create but can't edit records
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:
- 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.
- Create the Wordpress record
- 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:
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
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?
@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.
Fixed in #550.
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!