- Issue created by @camoa
- π©πͺGermany jurgenhaas Gottmadingen
This sounds amazing. As an ECA maintainer I'd be happy to provide help when needed.
- πΊπΈUnited States armyguyinfl Florida
Let's go! Can't wait for the Salesforce integration.
- πΊπΈUnited States camoa
After reviewing the Salesforce module, I've put together a list of potential events, conditions, and actions we could implement for the ECA integration. This is based on the existing Salesforce module architecture to ensure we're leveraging what's already available:
Events
Push Events
salesforce_eca.push_success
- Uses SalesforceEvents::PUSH_SUCCESSsalesforce_eca.push_fail
- Uses SalesforceEvents::PUSH_FAILsalesforce_eca.push_params
- Uses SalesforceEvents::PUSH_PARAMSsalesforce_eca.push_allowed
- Uses SalesforceEvents::PUSH_ALLOWED
Pull Events
salesforce_eca.pull_presave
- Uses SalesforceEvents::PULL_PRESAVEsalesforce_eca.pull_entity_value
- Uses SalesforceEvents::PULL_ENTITY_VALUEsalesforce_eca.pull_prepull
- Uses SalesforceEvents::PULL_PREPULLsalesforce_eca.pull_query
- Uses SalesforceEvents::PULL_QUERY
Error Events
salesforce_eca.error
- Uses SalesforceEvents::ERRORsalesforce_eca.warning
- Uses SalesforceEvents::WARNINGsalesforce_eca.notice
- Uses SalesforceEvents::NOTICE
Conditions
Object Conditions
salesforce_object_type
- Uses SObject class type checkingsalesforce_field_value
- Uses SObject field access methodssalesforce_object_exists
- Uses RestClient::objectRead() or RestClient::objectReadbyExternalId()
Mapping Conditions
salesforce_is_mapped
- Uses SalesforceMapping entity queriessalesforce_field_is_mapped
- Uses SalesforceMappingFieldPluginManagersalesforce_mapping_direction
- Uses SalesforceMapping properties
Entity Conditions
entity_has_sfid
- Uses MappedObject entity queriesentity_sync_status
- Uses MappedObject status propertyentity_recently_synced
- Uses MappedObject updated timestamp
System Conditions
salesforce_is_connected
- Uses RestClient::isInit()salesforce_api_limits
- Uses RestClient::getApiUsage()salesforce_queue_status
- Uses PushQueue service
Actions
Push Actions
salesforce_push_entity
- Uses MappedObject::push()salesforce_push_multiple
- Uses batch operations with MappedObject::push()salesforce_queue_push
- Uses PushQueue::createItem()
Pull Actions
salesforce_pull_object
- Uses RestClient::objectRead() and pull systemsalesforce_pull_by_query
- Uses SelectQuery objects with RestClient::query()salesforce_queue_pull
- Uses PullQueue::createItem()
API Actions
salesforce_execute_soql
- Uses SelectQuery objects with RestClient::query()salesforce_api_call
- Uses RestClient::apiCall()salesforce_create_object
- Uses RestClient::objectCreate()salesforce_update_object
- Uses RestClient::objectUpdate()salesforce_delete_object
- Uses RestClient::objectDelete()salesforce_upsert_object
- Uses RestClient::objectUpsert()
Mapping Actions
salesforce_create_mapping
- Uses SalesforceMapping entity creationsalesforce_update_mapping
- Uses SalesforceMapping entity updatesalesforce_delete_mapping
- Uses SalesforceMapping entity deletionsalesforce_sync_mapping
- Uses SalesforceMapping with batch operations
Data Transformation Actions
salesforce_transform_data
- Would need custom transformations, potentially with ECA's data pluginssalesforce_export_to_variable
- Uses ECA variable system with Salesforce data
Utility Actions
salesforce_log
- Uses Drupal logger systemsalesforce_clear_cache
- Uses Cache tags and bins related to Salesforcesalesforce_connection_test
- Uses RestClient::apiCall() with HEAD method
Common Use Cases
This integration would enable several key use cases without custom code:
- Enhanced Lead Generation: Trigger custom email sequences when leads are created in Salesforce
- Conditional Synchronization: Only push content to Salesforce if it meets specific criteria
- Cross-Platform Workflows: Create workflows spanning both systems
- Data Enrichment: Pull additional data from Salesforce based on form submissions
- Reporting Automation: Generate reports when Salesforce data meets thresholds
- Data Transformation Pipeline: Transform data formats between systems
- Batch Processing Management: Schedule and manage large-scale synchronization
- Connection Monitoring: Automatically monitor Salesforce connectivity
This is just a starting point - if there are other actions, events, or conditions people would find useful, let me know and we can expand this list!
- πΊπΈUnited States camoa
Initial Implementation of the Salesforce ECA Module and Execute SOQL Query Action
This comment provides an overview of the initial implementation of the Salesforce ECA module, focusing on the first action we've created:
salesforce_execute_soql
.Module Structure
We set up the following directory structure for the
salesforce_eca
module:salesforce_eca/ βββ config/ β βββ install/ β β βββ system.action.salesforce_execute_soql.yml β βββ schema/ β βββ salesforce_eca.schema.yml βββ src/ β βββ EventSubscriber/ β β βββ SalesforceEcaEventSubscriber.php β βββ Plugin/ β βββ Action/ β β βββ SalesforceExecuteSoql.php β βββ ECA/ β βββ Condition/ β βββ Event/ β β βββ SalesforceEvents.php β β βββ SalesforceEventsDeriver.php βββ salesforce_eca.info.yml βββ salesforce_eca.module βββ salesforce_eca.services.yml βββ README.md
Module Files
salesforce_eca.info.yml: Defines the module metadata and dependencies, including:
- salesforce:salesforce
- salesforce:salesforce_push
- salesforce:salesforce_mapping
- eca:eca
salesforce_eca.module: Implements
hook_eca_actions_info_alter()
to ensure our custom actions are properly categorized in the ECA UI.salesforce_eca.services.yml: Defines our EventSubscriber service which listens to Salesforce events and triggers corresponding ECA events.
Event Integration
The
SalesforceEcaEventSubscriber
class subscribes to all major Salesforce events (PUSH_ALLOWED, PUSH_PARAMS, PUSH_SUCCESS, PUSH_FAIL, PULL_PRESAVE, PULL_QUERY, PULL_PREPULL) and translates them into ECA events that can be used in ECA workflows.Event Plugin Implementation
The
SalesforceEvents
class and its deriver define the Salesforce events for ECA, includingsalesforce:push_allowed
,salesforce:push_params
,salesforce:push_success
, etc.Execute SOQL Query Action Implementation
The main focus of this initial implementation is the
SalesforceExecuteSoql
action, which:- Extends ECA's ConfigurableActionBase to properly integrate with the ECA system
- Provides two execution methods:
- A structured approach using the
SelectQuery
object withRestClient::query()
- A raw query option using
RestClient::apiCall()
for complex queries
- A structured approach using the
- Offers a configurable form with:
- A textarea for entering the SOQL query with token support
- A checkbox to toggle between structured and raw query execution
- A field to specify the token name where results will be stored
- Includes robust query parsing with extraction of object type, fields, conditions, ordering, limits, and offset
- Handles error conditions by catching exceptions and logging detailed error messages
- Implements access control by checking for the 'access salesforce' permission
Future Considerations
This implementation establishes a foundation for the Salesforce ECA integration. As we continue development, we should:
- Implement additional actions, conditions, and events as outlined in the proposed list
- Consider expanding token support across all aspects of the integration
- Ensure consistent error handling and permission checking across all actions
- Add comprehensive tests for all components
The current implementation of the
salesforce_execute_soql
action serves as a template for other API-related actions in the proposed list, particularly those that interact with the Salesforce REST client. - πΊπΈUnited States camoa
Initial Implementation of the Salesforce ECA Module and Execute SOQL Query Action
This comment provides an overview of the initial implementation of the Salesforce ECA module, focusing on the first action we've created:
salesforce_execute_soql
.Module Structure
We set up the following directory structure for the
salesforce_eca
module:salesforce_eca/ βββ config/ β βββ install/ β β βββ system.action.salesforce_execute_soql.yml β βββ schema/ β βββ salesforce_eca.schema.yml βββ src/ β βββ EventSubscriber/ β β βββ SalesforceEcaEventSubscriber.php β βββ Plugin/ β βββ Action/ β β βββ SalesforceExecuteSoql.php β βββ ECA/ β βββ Condition/ β βββ Event/ β β βββ SalesforceEvents.php β β βββ SalesforceEventsDeriver.php βββ salesforce_eca.info.yml βββ salesforce_eca.module βββ salesforce_eca.services.yml βββ README.md
Module Files
salesforce_eca.info.yml: Defines the module metadata and dependencies, including:
- salesforce:salesforce
- salesforce:salesforce_push
- salesforce:salesforce_mapping
- eca:eca
salesforce_eca.module: Implements
hook_eca_actions_info_alter()
to ensure our custom actions are properly categorized in the ECA UI.salesforce_eca.services.yml: Defines our EventSubscriber service which listens to Salesforce events and triggers corresponding ECA events.
Event Integration
The
SalesforceEcaEventSubscriber
class subscribes to all major Salesforce events (PUSH_ALLOWED, PUSH_PARAMS, PUSH_SUCCESS, PUSH_FAIL, PULL_PRESAVE, PULL_QUERY, PULL_PREPULL) and translates them into ECA events that can be used in ECA workflows.Event Plugin Implementation
The
SalesforceEvents
class and its deriver define the Salesforce events for ECA, includingsalesforce:push_allowed
,salesforce:push_params
,salesforce:push_success
, etc.Execute SOQL Query Action Implementation
The main focus of this initial implementation is the
SalesforceExecuteSoql
action, which:- Extends ECA's ConfigurableActionBase to properly integrate with the ECA system
- Provides two execution methods:
- A structured approach using the
SelectQuery
object withRestClient::query()
- A raw query option using
RestClient::apiCall()
for complex queries
- A structured approach using the
- Offers a configurable form with:
- A textarea for entering the SOQL query with token support
- A checkbox to toggle between structured and raw query execution
- A field to specify the token name where results will be stored
- Includes robust query parsing with extraction of object type, fields, conditions, ordering, limits, and offset
- Handles error conditions by catching exceptions and logging detailed error messages
- Implements access control by checking for the 'access salesforce' permission
Future Considerations
This implementation establishes a foundation for the Salesforce ECA integration. As we continue development, we should:
- Implement additional actions, conditions, and events as outlined in the proposed list
- Consider expanding token support across all aspects of the integration
- Ensure consistent error handling and permission checking across all actions
- Add comprehensive tests for all components
The current implementation of the
salesforce_execute_soql
action serves as a template for other API-related actions in the proposed list, particularly those that interact with the Salesforce REST client.