Custom event handler not triggering on opportunity status update

I’ve implemented a custom event handler in SAP CX 2105 to trigger notifications when opportunity status changes to ‘Negotiation’. The handler is registered and visible in the event monitoring dashboard, but it’s not firing when I update opportunities through the UI or API.

The event subscription seems correct - I’m listening to OpportunityStatusChangeEvent with proper field mappings. I’ve verified the custom field ‘statusCode’ is included in the trigger configuration. However, when I check the event logs, there’s no trace of the handler being invoked.

Here’s my handler registration:

@EventHandler(event = "OpportunityStatusChangeEvent")
public void onStatusChange(OpportunityEvent event) {
    if ("NEGOTIATION".equals(event.getNewStatus())) {
        notificationService.send(event.getOpportunityId());
    }
}

The workflow appears atomic - single status update, no batch operations. Has anyone encountered similar issues with event handlers not triggering in 2105? I’m wondering if there’s a configuration step I’m missing or if this is related to custom field inclusion.

I’ve seen this before. The event monitoring dashboard showing the handler doesn’t guarantee it’s properly subscribed. Check if your event subscription includes the specific entity type - sometimes handlers register globally but don’t bind to the correct entity context. Also verify that the custom field ‘statusCode’ is marked as ‘trigger-enabled’ in the field configuration.

I had almost identical issue last month. The root cause was the event subscription configuration using the wrong event name. SAP CX 2105 changed some event naming conventions - try ‘Opportunity.StatusChanged’ instead of ‘OpportunityStatusChangeEvent’. Also make sure your handler class is properly registered in the Spring context with @Component annotation. Without that, the event bus won’t pick it up even if it compiles fine.

Look at your annotation syntax. In SCX 2105, the @EventHandler annotation requires an explicit entity parameter. Your current setup might be too generic. Also, workflow atomicity can be tricky - if you’re updating multiple fields simultaneously, the event might be getting suppressed to avoid duplicate triggers. Check the event configuration for ‘debounce’ settings that might be filtering your events.

Let me provide a comprehensive solution based on the issues we’ve identified. The problem stems from multiple configuration gaps in your event handler setup.

Event Subscription Configuration: First, correct your event name. SAP CX 2105 uses ‘Opportunity.StatusChanged’ not ‘OpportunityStatusChangeEvent’. Update your handler:

@Component
@EventHandler(entity = "Opportunity", event = "StatusChanged")
public class OpportunityStatusHandler {
    @Autowired
    private NotificationService notificationService;

    public void onStatusChange(OpportunityEvent event) {
        if ("NEGOTIATION".equals(event.getNewStatus())) {
            notificationService.send(event.getOpportunityId());
        }
    }
}

Custom Field Inclusion: Navigate to Administration > Event Management > Event Schemas. Find the ‘Opportunity.StatusChanged’ schema and explicitly add ‘statusCode’ to the payload fields. This is critical - the field must be in the event schema even if it’s trigger-enabled in the entity definition. Without this, the event fires but your handler receives incomplete data.

Workflow Atomicity: The event monitoring dashboard may show your handler as registered but inactive if there’s a transaction boundary issue. Ensure your handler method is not wrapped in a transaction that conflicts with the event dispatch transaction. Add @TransactionalEventListener with phase=AFTER_COMMIT if you need transactional guarantees:

@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT)
public void onStatusChange(OpportunityEvent event) { ... }

Event Monitoring Dashboard Verification: After making these changes, verify in the event monitoring dashboard:

  1. Handler shows as ‘Active’ not just ‘Registered’
  2. Event subscription count increments when you update opportunities
  3. Check the ‘Failed Events’ tab for any exceptions being swallowed

The combination of incorrect event naming, missing schema configuration, and potential transaction conflicts explains why your handler wasn’t triggering. The event system was likely firing events but your handler wasn’t subscribed to the correct event signature. Make all three changes and test with a fresh opportunity status update.

One more thing to check - custom field inclusion requires explicit declaration in the event payload configuration. Even if the field is marked trigger-enabled, you need to add it to the event schema. Go to Administration > Event Management > Event Schemas and verify ‘statusCode’ is listed in the OpportunityStatusChanged schema. Without this, the event fires but your custom field value won’t be available in the handler context.

That’s interesting about the event naming. I’ll try the alternate format. I do have @Component on the class, but maybe there’s an issue with the Spring context initialization order. Let me test with the corrected event name first.

Thanks for the suggestion. I checked the entity binding and it’s set to ‘Opportunity’ entity type. The statusCode field has trigger-enabled=true in the metadata. Still no luck. I’m wondering if the problem is related to how the event is being raised - maybe the UI update doesn’t propagate the event properly?