June 2017
Beginner to intermediate
334 pages
7h 11m
English
To subscribe to platform events, one can use Apex triggers. If you are subscribing to the events outside the Salesforce platform, one has to use CometD ( https://cometd.org/). CometD uses the Bayeux protocol to publish and subscribe messages.
Let's write an Apex trigger to create a case record in Salesforce when the Temperature Sensor sends a temperature of less than 20 degrees Celsius and above 35 degrees Celsius.
Before that, let's create a field on the Contact named EmployeeId so that we can relate the case with the correct Salesforce contact record. The following screenshot shows a sample Test Contact with EmployeeId, for which we will be publishing the event:
The trigger code to subscribe to the event ...
Read now
Unlock full access