public with sharing class lexOpportunitySpecialApplyController { @AuraEnabled public static InitData initForSpecSubmitButton(String recordId){ InitData res = new InitData(); try { OpportunitySpecialApply__c opp = [ select Apply_Reason__c, Is_upload_file__c, Status__c from OpportunitySpecialApply__c where Id =: recordId ]; res.applyReason = opp.Apply_Reason__c; res.isUploadFile = opp.Is_upload_file__c; res.status = opp.Status__c; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } @AuraEnabled public static string updateForSpecSubmitButton(String recordId){ OpportunitySpecialApply__c opp = new OpportunitySpecialApply__c(); try { opp.Id = recordId; opp.Status__c = lexLightingButtonConstant.STATUS_OPPORTUNITY_SPECIAL_APPLY_SUBMIT; update opp; return ''; } catch (Exception e) { if (e.getMessage().contains(',')) { System.debug(LoggingLevel.INFO, '*** e: ' + e); String exc = '' + e.getMessage(); Integer left = exc.indexOf(':') + 1; Integer right = exc.lastIndexOf(':'); String str = exc.substring(left,right); left = str.indexOf(',') + 1; String newStr = str.substring(left); return newStr; }else { return e.getMessage(); } } } public class InitData{ @AuraEnabled public String applyReason; @AuraEnabled public Boolean isUploadFile; @AuraEnabled public String status; } }