I'm using the "create mapped object" feature in the Salesforce Mapped Objects form to push a contact message entry to Salesforce. The mapped entity fields are pre-filled when I enter the form but when I click on Push I get a white screen with the following error message:

The website encountered an unexpected error. Please try again later.
Error: Call to a member function getEntityTypeId() on null in Drupal\salesforce_mapping\Plugin\Validation\Constraint\MappingEntityTypeConstraintValidator->validate() (line 19 of modules/salesforce/modules/salesforce_mapping/src/Plugin/Validation/Constraint/MappingEntityTypeConstraintValidator.php).

I tried turning off this validation constraint to see what would happen. If I do that I get the following error message on the form screen (doesn't break this time, though):

There are no entities matching " (1128)".

I'm not sure if these errors are related but it seems to me that the module is not able to get the info of the selected contact message entity in the form. I also notice that the target_id autocomplete field is trying to reference a comment type rather than the contact_message type. The path is something like:

data-autocomplete-path="/entity_reference_autocomplete/comment/default%3Acomment/qY_gILRPdqf5xqWeNOfwL7jcdPWi8bZ2nW6PBltLIik" ...

Comments

cqbent created an issue. See original summary.

aaronbauman’s picture

can you upload the mapping you're using?

  • aaronbauman committed eea87ec on 8.x-3.x
    Issue #3003902: add type check to constraint validator to avoid WSOD in...
aaronbauman’s picture

I was able to recreate this issue by disabling javascript and pushing through an invalid entity-type / entity-id pair.
Previous commit eea87ec should fix, but please confirm.

cqbent’s picture

Can confirm that those changes fixed the issue with the first error, thanks. I was still getting the "no matching entities" warning so I did a little more digging and I think my issue has to do with the fact that I had the "subject" field disabled in the contact form. The subject field is used to reference the target contact entity in the mapping autocomplete field so my guess is that having this value null is causing the "no matching entities" issue (and probably the getEntityTypeId null issue as well). I reenabled the subject field and tested and its able to push successfully now.

kmeisthax’s picture

I'm working on a website in which we need to map contact form messages without a subject to SalesForce. The design of the form precludes the use of a subject (it won't be populated, we aren't collecting one, etc). Is it possible to change the autocomplete field so that it will accept entities without a title, perhaps with a preprocess hook?

aaronbauman’s picture

Seems like you could work around this by enabling push triggers for your mapping(s)?

I'm not sure what features are available for the entityreference autocomplete widget.
We're relying on the widget from core, so there may be an issue open for this in core.
Might want to check there first.

aaronbauman’s picture

aaronbauman’s picture

Status: Active » Postponed (maintainer needs more info)
aaronbauman’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

8.x is no longer supported

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.