public with sharing class lexNewOnLineSurvey2Controller { public lexNewOnLineSurvey2Controller() { } @AuraEnabled public static InitData init(String recordId){ InitData res = new InitData(); try { List r= [SELECT CreatedById from Contact where id=:recordId]; res.CreatedById=r.get(0).CreatedById; } catch (Exception e) { return res; } return res; } // @AuraEnabled // public static InitData initForNewOnLineSurveyButton(String recordId){ // InitData res = new InitData(); // try { // Report__c re = [ // select // Date__c, // Practitioner1__c, // OwnerId // from Report__c where Id =: recordId // ]; // res.ownerId = re.OwnerId; // res.datec = re.Date__c; // res.practitioner1 = re.Practitioner1__c; // } catch (Exception e) { // throw new AuraHandledException(e.getMessage()); // } // return res; // } public class InitData{ @AuraEnabled public String Name; @AuraEnabled public String CreatedByNameC; @AuraEnabled public String CreatedById; } }