public with sharing class lexSolutionProgrammeController { @AuraEnabled public static InitData initSubmitSolutionSchemeForApprovalButton(String recordId){ InitData res = new InitData(); try { Solution_Programme__c so = [ select Scheme_Type__c, Confirmation_Result__c from Solution_Programme__c where Id =: recordId ]; res.schemeType = so.Scheme_Type__c; res.confirmationResult = so.Confirmation_Result__c; } catch (Exception e) { System.debug(e.getMessage()); } return res; } @AuraEnabled public static List queryForAttachments(String Id){ List so = new List(); try { so = [select id,name from solutionClosingAttachment__c where Solution_Programme__c =: Id]; } catch (Exception e) { System.debug(e.getMessage()); } return so; } @AuraEnabled public static string updateSubmitSolutionSchemeForApprovalButton(String recordId){ Solution_Programme__c so = new Solution_Programme__c(); try { so.Id = recordId; so.Submint_TF__c = true; update so; 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(); } } } //提交审批 @AuraEnabled public static String submitApproval(String recordId){ Savepoint sp = Database.setSavepoint(); try { Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest(); req1.setObjectId(recordId); Approval.ProcessResult submitResult = Approval.process(req1); return 'OK'; } catch (Exception e) { Database.rollback(sp); 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 schemeType; @AuraEnabled public String confirmationResult; } }