Problem/Motivation

The 7.x-3.x version had an option on the mapping interface to select which Record Types to request on pull, making it easy to see what the mapping was targeting, and easy to configure. 8.x+ replaced this with a more flexible but less user-friendly 'Pull query SOQL "WHERE" clause' field, which is very handy, but less user-friendly. There's no reason not to allow both to be used, as you can add multiple "where" clauses to an API call, making the existence of both pretty clean in the code.

Added motivation for this: we are using the module in a distribution, which uses a Salesforce package. The SF package does not stabilize record type IDs, so we have to customize this setting for every site. Much easier with a quick point-and-click than digging out record IDs each time.

Proposed resolution

Add another config field on mappings for this.

Remaining tasks

Probably needs a test.

User interface changes

Just another field on the mapping UI.

API changes

None.

Data model changes

Just another field on the mapping config.

Issue fork salesforce-3213468

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

gcb created an issue. See original summary.

gcb’s picture

Status: Active » Needs review
StatusFileSize
new5.42 KB
aaronbauman’s picture

Status: Needs review » Needs work

I would rather avoid relying on the RecordType.Id, which changes between environments.
This will be troublesome to manage, when otherwise mappings to not need to change between environments.

gcb’s picture

Assigned: Unassigned » gcb

Good point. It didn't occur to me that there was another option! Do you know if we're able to use RecordType.label in SOQL queries? I can dig into the api and/or experiment of course.

aaronbauman’s picture

RecordType.DeveloperName is the preferred source

gcb’s picture

Assigned: gcb » aaronbauman
Status: Needs work » Needs review

Thanks! That is... much better.

Re-rolled to use developer name as an issue fork as I saw you appreciating those in some other ticket ;)

gcb’s picture

Version: 8.x-4.2 » 8.x-4.x-dev
gcb’s picture

Oops, my initial attempt to convert to an issue branch went poorly. I undid my direct commits to the 8.x-4.x branch and did it properly.

gcb’s picture

StatusFileSize
new5.65 KB

Not sure how to do a separate issue branch for 5.x, so... here's a patch that applies to 5.x!

damienmckenna’s picture

Version: 8.x-4.x-dev » 5.0.x-dev
damienmckenna’s picture

StatusFileSize
new5.4 KB

Rerolled.

dishvola’s picture

Hey DamienMcKennam, why you are removed 'Pull query SOQL "Where" clause' option?

-      $form['pull']['pull_where_clause'] = [
-        '#title' => $this->t('Pull query SOQL "Where" clause'),
-        '#type' => 'textarea',
-        '#description' => $this->t('Add a "where" SOQL condition clause to limit records pulled from Salesforce. e.g. Email != \'\' AND RecordType.DeveloperName = \'ExampleRecordType\''),
-        '#default_value' => $mapping->pull_where_clause,
wxactly’s picture

StatusFileSize
new5.14 KB

It looks like the extra pull_where_clause code was removed in https://git.drupalcode.org/project/salesforce/-/commit/d041e14e5e00c020e... so the patch in #12 was accidentally removing it again. Here's another reroll that leaves pull_where_clause alone

wxactly’s picture

wxactly’s picture

damienmckenna’s picture

Thanks for fixing the patch, wxactly.

  • AaronBauman committed 4d7e9fc5 on 5.0.x authored by wxactly
    Issue #3213468 by gcb, DamienMcKenna, wxactly: Allow easy pull filtering...
aaronbauman’s picture

Status: Needs review » Fixed

Committed, thanks for everyone's work on this

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.