Ive created a platform event in salesforce and am unable to reference it in my code to trigger the event, below is my event object I have created.

enter image description here

The error I am receiving can be seen below

classes/InboundILOS.cls: Invalid type: ILOSRecording_Event__e (Line: 22, Column: 9)

And my code where I am trying to create the ILOSRecording_Event__c list is below.

global with sharing class InboundILOS {

    global static String createILOS() {
        ILOS_Intergration_Post__c w = new ILOS_Intergration_Post__c();
        String requestBody = RestContext.request.requestBody.toString();
        w.JSON_Response__c =requestBody;
        JSON2ApexResp resp = JSON2ApexResp.parse(requestBody);
        List<ILOSRecording_Event__e> e = new List<ILOSRecording_Event__e>();
        insert w;
        return 'Upload Complete';
  • 2
    What API Version are you using? That's pretty vital information here... – Adrian Larson Oct 19 '17 at 13:47
  • API version is 36.0 – Nebbyyy Oct 19 '17 at 13:52

The Platform Event feature was introduced very recently. Any time you are making use of such a new feature, make sure you set the API Version to the most up to date value available.

  • 2
    And if it's early 2019, and you're editing an old class, you might find this is the reason why sfdx is moaning about unexpected errors. – Matt Lacey Jan 4 '19 at 2:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.