Add "Get Salesforce mapped object" action

Created on 10 June 2025, about 1 month ago

Problem/Motivation

When working with entities that are synchronized with Salesforce, users need a way to retrieve the mapping information to use with other Salesforce ECA actions.

Common use cases:

  • Check if an entity has a Salesforce mapping
  • Get the Salesforce ID for subsequent field retrieval
  • Access sync status and timestamps
  • View Salesforce URL for the mapped record

Steps to reproduce

  1. Create an ECA model with "Content entity: View" event
  2. Try to get Salesforce field values for the viewed entity
  3. No way to get the Salesforce ID and object type needed

Proposed resolution

Add a focused action for retrieving mapped object information from entities.

Remaining tasks

  • [x ] Create action plugin
  • [x ] Use MappedObjectStorage::loadByEntity()
  • [ x] Support optional mapping ID filter
  • [x ] Return comprehensive mapping data as tokens
  • [ ] Test with multiple mappings per entity

User interface changes

New action "Get Salesforce mapped object" will appear in ECA.

API changes

None.

Data model changes

None.

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States camoa

Live updates comments and jobs are added and updated live.
  • API addition

    Enhances an existing API or introduces a new subsystem. Depending on the size and impact, possibly backportable to earlier major versions.

Sign in to follow issues

Comments & Activities

  • Issue created by @camoa
  • πŸ‡ΊπŸ‡ΈUnited States camoa

    Get Salesforce Mapped Object action implemented and committed.

    What it does: Load the Salesforce mapped object information for any Drupal entity. Provides the Salesforce ID, object type, and sync status needed for other Salesforce operations. Essential companion to the field retrieval action.

    Key features:

    • Uses MappedObjectStorage::loadByEntity() from Salesforce contrib
    • Returns complete mapping information including sync status
    • Supports multiple mappings (returns first by default)
    • Optional filtering by specific mapping ID
    • Provides sync timestamps and status information

    Available tokens:

    • Mapping status: [token:is_mapped] (1/0), [token:mapping_count]
    • Salesforce data: [token:salesforce_id], [token:salesforce_object_type] (Contact, Lead, etc.)
    • Mapping info: [token:mapping_id], [token:mapped_object_id]
    • Sync status: [token:last_sync_status] (1/0), [token:last_sync_action] (push_create, pull_update, etc.)
    • Other: [token:salesforce_url] (direct link), [token:entity_updated] (timestamp)

    Example usage:

    • Entity view: Get mapping info when viewing any content
    • Pre-sync check: Verify mapping exists before push/pull operations
    • Chain with field retrieval: Use [token:salesforce_id] and [token:salesforce_object_type] in subsequent actions
    • Multiple mappings: Access [token:all_mappings] array when entity has multiple mappings

    Testing: Successfully tested with mapped and unmapped entities. Correctly retrieves Salesforce IDs, object types, and sync status. Works perfectly as input for field retrieval actions.

    Files added/changed:

    • src/Plugin/Action/SalesforceGetMappedObject.php (new action)
    • config/schema/salesforce_eca.schema.yml (configuration schema)

    Now you can easily access Salesforce mapping information for any entity, enabling complete entity viewing workflows and sync status checks.

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

Production build 0.71.5 2024