MinnPost / object-sync-for-salesforce

WordPress plugin that maps and syncs data between Salesforce objects and WordPress objects.
https://wordpress.org/plugins/object-sync-for-salesforce/
GNU General Public License v2.0
94 stars 51 forks source link

SOQL queries don't use the Salesforce record types to filter results #383

Closed jonathanstegall closed 3 years ago

jonathanstegall commented 3 years ago

Describe the bug When a Salesforce object type has record types associated with it, we show them to users who are working with fieldmaps. All of the record types are displayed with checkboxes as "allowed record types" and one of them has a dropdown for "default record type." The default record type, if it exists, is what a record is saved as when it is pushed from WordPress.

We use this setting info in various places throughout the plugin, but we don't currently use it to filter the SOQL query that pulls updated records from Salesforce. This can cause queries to be much bigger than they need to be.

To Reproduce Steps to reproduce the behavior:

  1. Make a fieldmap that uses a Salesforce object type with record types (ex Opportunity) that pulls data from Salesforce. Check some of the allowed record types but not all of them
  2. Log the SOQL query that it runs
  3. Optionally log the records that it loops through

Expected behavior I think the SOQL query should only pull records where the record type is one of the allowed record types. The pull query can ignore the default record type, I think.

Screenshots The screen looks like this. image

Additional context I'm a little worried about why I overlooked this for so long. I'd like to look through the history of the file a little and just make sure there wasn't some weird intentionality in this.

jonathanstegall commented 3 years ago

I'm also a little curious whether this warrants a 1.10.0 version, or whether it should still be 1.9.x.

jonathanstegall commented 3 years ago

Start with looking at these lines because it really makes it seem like I started on this and then forgot about it?

jonathanstegall commented 3 years ago

This is where it was removed. It does not seem to have been intentional, as far as I can tell.