Skip to content

Instantly share code, notes, and snippets.

@tsmalara
Last active October 9, 2018 02:21
Show Gist options
  • Save tsmalara/5491c5164e0bfdeeaff2a079c4aa7ab1 to your computer and use it in GitHub Desktop.
Save tsmalara/5491c5164e0bfdeeaff2a079c4aa7ab1 to your computer and use it in GitHub Desktop.
public class EmpApi_exampleController {
@AuraEnabled
public static void publishEvent()
{
System.debug('Published Event!');
Demo_EmpApi_Event__e event = new Demo_EmpApi_Event__e(Message__c=message);
Database.SaveResult result = EventBus.publish(event);
if (!result.isSuccess()) {
for (Database.Error error : result.getErrors()) {
System.debug('Error returned: ' + error.getStatusCode() +' - '+ error.getMessage());
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment