Can no longer select SF Record Types in mapping UI

Created on 28 March 2024, 10 months ago
Updated 21 June 2024, 7 months ago

Problem/Motivation

Mapping settings page allows you to select Record Types to filter pull, the field "Record Types to Request". This field no longer populates the record type options.

Steps to reproduce

Edit a mapping for an SF Object type with multiple record types, note the empty list.

Proposed resolution

This is due to a quirky PHP behavior with "empty()" where it doesn't evaluate whether an object property is empty correctly.

Remaining tasks

patch to be submitted shortly.

User interface changes

None

API changes

None

Data model changes

None

🐛 Bug report
Status

Needs review

Version

5.1

Component

salesforce_mapping_ui.module

Created by

🇺🇸United States gcb

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @gcb
  • 🇺🇸United States gcb

    We can fix by getting more clever with our check, or by making the Rest object generally respond better to isset checks, which seems like a better general solution.

  • Status changed to Needs review 10 months ago
  • 🇺🇸United States RoloDMonkey

    I was experiencing this issue and the patch fixed it. This is probably only happening because I am running PHP 8.2+.

    I also agree that this might not be the best long-term solution

    Here is a link to the quirk mentioned in the summary.
    https://www.php.net/manual/en/function.empty.php#:~:text=named%20arguments.-,Note%3A,-When%20using%20empty

  • 🇺🇸United States gcb

    It happened for me on PHP 8.1! I was suggesting this solution is better than changing the "isset()" check to something else, actually, and that this was indeed a good long-term solution because it makes our object behave as intuitively expected, rather than simply avoiding the confusing behavior and leaving the trap in place. It's possible we need to implement this function in other objects as well, though.

  • 🇮🇳India ankithashetty Karnataka, India

    Thanks for the patch @gcb!
    Able to see the mappings on UI after the patch.

    The only thing is, even if we select one record type to pull from Salesforce, it pulls in all the record types, not just the one I selected.
    Any way to handle that?

    Thanks again!

  • 🇺🇸United States gcb

    @ankithashetty I haven't experienced that bug, but it sounds like it merits its own ticket. While it is related to the same feature, it is not related to the same bug: this ticket was just for the form not being able to list the record types anymore. As far as I can tell, nothing about this code has caused any new bugs.

    Please provide more information in that ticket if you can, as I'm not able to get a reproduction. Can you tell us what the "conditions" property on the Soql query are when it is dispatched to Salesforce in `\Drupal\salesforce_pull\QueueHandler::getUpdatedRecordsForMapping` for example? And share the mapping configuration yml file? Adding those to your new issue will help us reproduce the bug.

  • 🇺🇸United States gcb
Production build 0.71.5 2024