Add "Get Salesforce Field Value" action

Created on 9 June 2025, 3 days ago

Problem/Motivation

When working with Salesforce data, users often need to extract a specific field value from a record. Currently, they must use the full API call action even for simple field retrieval.

Common use cases:
- Get a custom field value after entity push
- Extract specific data from Salesforce records
- Retrieve field values for workflow decisions

Steps to reproduce

1. Create an ECA model
2. Try to get a single field from a Salesforce record
3. Must use complex API call for simple field access

Proposed resolution

Add a focused action for retrieving field values from Salesforce records.

Remaining tasks

- [ ] Create action plugin
- [ ] Add configuration for object type and field name
- [ ] Support both Salesforce ID and entity reference
- [ ] Store result in token
- [ ] Test with various field types

User interface changes

New action "Get Salesforce field value" 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
  • πŸ‡ΊπŸ‡ΈUnited States camoa
  • πŸ‡ΊπŸ‡ΈUnited States camoa

    Get Salesforce Field Value(s) action implemented and committed.

    What it does: Retrieve one or more field values from a Salesforce record. Simpler alternative to SOQL for single record field access. Perfect for fetching auto-generated fields after push operations or displaying Salesforce data when viewing Drupal entities.

    Key features:

    • Dual ID support: Standard Salesforce IDs and External IDs
    • Flexible field retrieval: single field, multiple fields, or all fields (*)
    • Efficient objectRead() API for retrieving all fields
    • Comprehensive error handling with specific messages
    • Field validation showing which requested fields don't exist

    Available tokens:

    • Direct field access: [token:Email], [token:FirstName], [token:CustomField__c]
    • Status: [token:success] (1/0), [token:error] (error message)
    • Metadata: [token:object_type], [token:record_id]
    • Field info: [token:field_count], [token:all_field_names] (array), [token:fields_not_found]
    • All fields: [token:fields] (associative array)

    Example usage:

    • Specific fields: Email,FirstName,LastName,Phone
    • All fields: Leave empty or use *
    • External ID lookup: Check "Use External ID", set field name (e.g., Email) and value
    • After push: Use [mapped_object:salesforce_id] to fetch MDVIP_ID__c or other generated fields

    Testing: Successfully tested with standard IDs, external ID lookups, field validation, and error handling. Integrates perfectly with mapped object tokens from other actions/conditions.

    Files added/changed:

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

    Now you can easily retrieve Salesforce field values without writing SOQL queries. Essential for displaying Salesforce data on entity views and fetching auto-generated fields after push operations.

Production build 0.71.5 2024