I have an aura component that generates new record. The helper calls the Apex controller and the records are generated but they are done via a platform event. How can I determine when the platform event is completed. I want to get the ids of the new records.
helper
var action = component.get("c.submitRecord");
getJobid: function(component, event, helper, tempId){
is job created??????
}
Controller
@AuraEnabled
public static String (sObject order, sObject job)
{
order__c orders= (orders__c) order;
job__c jobs = (job__c) job;
insert orders;
jobs.order__c = orders.Id; //original code before platform event but received error
insert jobs; //original code before platform event but received error
Publish_Job__e createJob = new Publish_Job__e();
createJob.job_JSON__c = jobJSON;
createJob.job_title__c = 'Title';
Eventbus.publish(createJob);
Best Answer
Assuming that the arrangement you have is necessary, I'd use the lightning:empApi library to subscribe to a second Platform Event that could be fired off by the Platform Event trigger to get the data from the child object once it's done.