Solving Subscribe to a Platform Event in an Apex Trigger Challange
The trailhead challange says: Your Salesforce app uses a trigger to listen to events. Once your app receives the notification from the order system through the trigger, it creates a task to follow up on the order shipment. Create an Apex trigger named OrderEventTrigger for Order_Event__e. This trigger will be similar to the CloudNewsTrigger trigger, but operates on the Order_Event__e event and creates tasks instead of cases. If the order has shipped ( event.Has_Shipped__c == true ), create a task with the following values: Priority: 'Medium' Subject: 'Follow up on shipped order ' + event.Order_Number__c OwnerId: event.CreatedById (Note: You are assigning the task OwnerId to the same user who published the event. This step keep things simple so you don't have to perform any prerequisites.) For this, you only need to create the OrderEventTrigger: trigger OrderEventTrigger on Order_Event__e ( after insert ) { //List to hold all tasks