Created
October 20, 2017 00:37
-
-
Save alexed1/0ec54f8e4d801c3c257ad26daec9455b to your computer and use it in GitHub Desktop.
main component apex controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class NBAComponentController { | |
@AuraEnabled | |
public static String getSessionId() { | |
return UserInfo.getSessionId(); | |
} | |
@AuraEnabled | |
@future | |
public static void launchFlow() { | |
System.debug('entering launchFlow'); | |
Flow.Interview flow = new Flow.Interview.NBADemoV2_1(new map<String,Object> {'vAccountId' => 5}); | |
flow.start(); | |
} | |
@AuraEnabled | |
public static void pubRecommendationRequest() { | |
// Create an instance of the event and store it in the newsEvent variable | |
Recommendation_Request__e reqRequestEvent = new Recommendation_Request__e( | |
Body__c='Please send recommendations', | |
Status__c='a05R0000000GH3a'); | |
// Call method to publish events | |
Database.SaveResult sr = EventBus.publish(reqRequestEvent); | |
// Inspect publishing result | |
if (sr.isSuccess()) { | |
System.debug('Successfully published event.'); | |
System.debug(reqRequestEvent.Status__c); | |
} else { | |
for(Database.Error err : sr.getErrors()) { | |
System.debug('Error returned: ' + | |
err.getStatusCode() + | |
' - ' + | |
err.getMessage()); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment