//author : kkbes public with sharing class LexInquiryController { @AuraEnabled public static Task init(String recordId){ Task res = new Task(); try{ res=[SELECT Id,Related_Opportunity1__c,QuoteIraiId__c ,Status FROM Task WHERE Id = : recordId ]; } catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } @AuraEnabled public static List getOpportunityIds(String RelatedOpportunity1){ List res = new List(); try{ res=[SELECT id FROM Opportunity WHERE Opportunity_No__c = : RelatedOpportunity1]; } catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } @AuraEnabled public static QuoteIrai__c getQuoteIrai(String QuoteIraiId){ QuoteIrai__c res = new QuoteIrai__c(); try{ res=[SELECT Id,Lead__c FROM QuoteIrai__c WHERE Id = : QuoteIraiId ]; } catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } @AuraEnabled public static String makeAndUpdateLead(String leadId,String Id,String QuoteIraiId){ Lead res = new Lead(); try{ res.Id = leadId; res.Opp_Name_Search__c = Id; if(QuoteIraiId != ''){ res.LatestQuotationEntrustment__c=QuoteIraiId; } update res; return 'success'; } catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); String a = e.getMessage()+' And '+e.getCause(); return a; } } @AuraEnabled public static String makeAndUpdateTask(String Status,String Id){ Task res = new Task(); try{ res.Id = Id; res.Status = Status; res.Quotation_request_completed_time__c = System.now(); update res; return 'success'; } catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); return e.getMessage(); } } @AuraEnabled public static String makeAndUpdateQuoteIrai(String QuoteIraiStatus,String Id){ QuoteIrai__c res = new QuoteIrai__c(); try{ res.Id = Id; res.QuoteIrai_Status__c = QuoteIraiStatus; update res; return 'success'; } catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); return e.getMessage(); } } }