2

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.

@RestResource(urlMapping='/Widgets/*')
global with sharing class InboundILOS {

    @HttpPost 
    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);
        System.debug(resp.token);
        w.token__c=resp.token;
        w.videoURL__c=resp.videoURL;
        w.embedURL__c=resp.embedURL;
        w.randTag__c=resp.randTag;
        w.iframe__c=resp.iframe;
        List<ILOSRecording_Event__e> e = new List<ILOSRecording_Event__e>();
        insert w;
        return 'Upload Complete';
   }
  • 1
    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
10

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 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.