public Class QuoteTriggerHandler{ public static void AfterUpdate(List newQuots, Map oldQuote){ Set OrderReady = new Set(); List ordertoUpdate = new List(); for (Quote qte : newQuots) { if(qte.status!=null && qte.status!= oldQuote.get(qte.Id).status && qte.status=='Order Placed'){ Order o1= new Order(); o1.Quote= qte.id; ordertoUpdate.add(o1); OrderReady.add(qte.id); } } if(!ordertoUpdate.isEmpty()) INSERT as system ordertoUpdate; if(!OrderReady.isEmpty()) processOrderProducts(OrderReady); } @future public static void processOrderProducts(Set quoteIds){ List allOrders =[SELECT Id from Order where Quote in: quoteIds]; List allQuotes =[SELECT Id,(SELECT Id, Startdate, enddate, Quantity from QuoteLines) from Quote where Id in: quoteIds]; Map qteOrderMap= new Map(); for(Order o1: allOrders){ qteOrderMap.put(o1.Quote, o1.id); } List<>OrderProduct> opsToUpdate =new List<>OrderProduct> (); for(Quote quote: allQuotes){ if(!quote.QuoteLines.isEmpty()){ opsToUpdate.addALL(QuoteTriggerHandler.createOrderProducts(quote.QuoteLines);) } } if(!opsToUpdate.isEmpty()) INSERT as system opsToUpdate; } public static List createOrderProducts(List quoteLines){ Map> productQL = new Map> (); for(QuoteLine ql: quoteLines){ if(productQL.containsKey(ql.productName)){ productQL.put(ql.productName, productQL.get(productQL).add(ql)); }else { productQL.put(ql.productName, new List{ql}); } } List<>OrderProduct> ops =new List<>OrderProduct> (); for(String pname: productQL.KeySet()){ list qlines = productQL.get(pname); Date Startdate= qlines[0].Startdate; Date enddate= qlines[0].enddate; Date initialQ =qline[0].Quantity; Date finalQ =qline[0].Quantity; for(Integer i=1; i< qlines.size();i++ ){ if(qlines[i].Startdate < Startdate){ Startdate = qlines[i].Startdate; }else if(lines[i].Startdate = Startdate)){ initialQ +=qline[i].Quantity; } if(qlines[i].enddate > enddate){ enddate = qlines[i].enddate; } finalQ +=qline[i].Quantity; } OrderProduct op =new OrderProduct(); op.Order=qteOrderMap.get(qlines[0].Quote); op.Startdate =Startdate; op.enddate=enddate; op.initialQuantity =initialQ; op.finalQuoantity = finalQ; ops.add(op); } return ops; } }
Salesforce Analyst Interview Questions
5,294 salesforce analyst interview questions shared by candidates
Write a Salesforce trigger to accomplish a task in this text editor window.
Q: Write push and pop nodes using Linked List data structure.
Tell me about your self..
What are your weaknesses
Exception handling, Mobile freindly front end development, Parent soql queries, sosl queries, Lightning communities, Experience builder
What do you think sales is? What books have you read. What do you study? Why Salesforce? Salesforce is very fast paced, can you handle this?
Explain APEXe with intense knowledge about Salesforce process sales cloud service cloud
How have you demonstrated Salesforces values?
Past project experience and few simple questions
Viewing 3381 - 3390 interview questions