This video was not much basic. complexity escalated quickly....For the first time teacher in your videos kinda assumed that we would be knowing some statements in the code already which was not true...
you cannot expect that a free on-line course is going to explain every sentence and operator. Read the documentation, just search the statement you are not familiar with.
The code presented at 41:19 on avoiding recursion has a logical inconsistency. The TestTrigger is set to run before insert, but the condition in the trigger body checks for Trigger.isAfter. This condition would never return true because the trigger itself only runs in the before context.
At 23:23 Why we have used only 'new' context variable for new value and 'oldMap' for the previous value . Instead could we have used 'old' context variable .
In Order of Execution System Validations run before "Before Triggers" but in the video it is in reverse. Please let me which one is first either before triggers or system validations.
You are doing a great job guys! I have one question. When you say I should use Triggers for Integration with External Sys. You mean in every case? For example why I shouldn't use outbound message working as a trigger to send an event to an endpoint?
Hello there, I have clarification on assignment - i)create custom object invoice with field total amount ii)create child object invoice line item with lookup relationship to invoice iii)add price field into invoice line item I have created 'invoice' object and field 'total amount' now how to create lookup relation on child object I'm confused whether we can create relationship on object, it can be created on fields only as I know or maybe something I don't know on this. can anyone plz guide.
Hi team..I am thorough follower of this channel..but sorry just because of work not able to attend live sessions..not sure if I missed 17,18 and 19 uploads..hope they will come soon..
My SOlution to the challenge trigger InvoiceLineItemTrigger on Invoice_Line_Item__c (after insert,after update) { //Update the SumofInvoiceItems field in Invoice object with sum of prices of its related Inv Line Items //Get Invoice related to Invoice Line items Set invoiceIds = new Set(); for(Invoice_Line_Item__c lineItem: Trigger.new){//IL1->I1, IL2->I1, IL3->I2, IL4-I2,IL5-I3,IL6-I4 invoiceIds.add(lineItem.Invoice__c); } System.debug('Invoice Ids'+invoiceIds); List invoiceList = [SELECT id,Sum_of_Invoice_Line_Items__c,(SELECT id, Price__c from InvoiceLineItems__r) from Invoice__c WHERE ID IN: invoiceIds]; system.debug('invoiceList'+invoiceList); for(Invoice__c inv: invoiceList){ List invoiceLineItemList = inv.InvoiceLineItems__r;//(I1-(IL1,IL2)) Decimal sum = 0; for(Invoice_Line_Item__c ilv: invoiceLineItemList){//(IL1-Null,IL2-200) if(ilv.Price__c!=NULL){ sum+=ilv.Price__c; } } system.debug(sum); inv.Sum_of_Invoice_Line_Items__c = sum; system.debug('Sum_of_Invoice_Line_Items__c'+inv.Sum_of_Invoice_Line_Items__c); } update invoiceList; }
thanks for the video...definately its a good channel for salesforce development preraration..but in this video you are not given much more knowledge about apex triggers..in this video you only explained about the question what is trigger....but actually you didnt get more examples of trigger and not explained examples as well as clearly.
Sir any suggestions which trigger scenarios are asked most of the times for fresher? Please suggest few so that i can practice them before the interview
sir plz make video or guidance on projects i have complted admin and development parts ... sir plz make video on projects i need job.... i love apex hours.
so the order of execution is before trigger, validation, after trigger, assignment rules , workflow rules and the commit to database . Is this correct?
@@apexhours Hi, Couldn't find links for those two trails on the website given in the description of this video. Can you please provide the link here if possible ? It will be huge help. Thanks. : )
I have written a before trigger to update the contact description on contact creation as well as wrote a workflow for the same but what I have observed it is updating record from worklows not from trigger but according to the order of execution it should update the record from trigger right??
so @39:47 if we would have trigger event as before update then will the recursion not happen, its a bit confusing, so when you added a recursive check then also the trigger will be called after creating an account @41:46 am i right and it will try to insert again? Please can you clear this doubt.
This was the worst session among the others... the guy has no idea... just copy pasting codes, and exclaiming "Yup, executed" without explaining anything. Of course it will execute, you have copy-pasted a done and tested code. The English is the worst, and it was a challenge to understand what he is saying.
what else there is to explain?. The trigger sent a mail. He said the trigger will send an email and showed that it did. If there is a statement you dont understand, search for it on the documentation. And "just copy and pasting" thats like 99% of on-line courses. Thank god they don't write code live so we don't have to deal with dumb bugs and typos
My solution for assignment. trigger TotalInvoiceAmount on Invoice_Line_Item__c (after insert) { Map UniqueInvoiceToUpdate = new map(); // To maintain unique sobject to be updated Map TotalAMount = new Map(); // To maintain the updated amount of each invoice sobject ListInvoiceToUpdate = new List(); // final list to perform dml update operation Invoice__c ParentInvoice; for (Invoice_Line_Item__c currentInvoiceItem : Trigger.New) { ParentInvoice = [select id, Total_Amount__c from Invoice__c where Id = :currentInvoiceItem.Invoice__c LIMIT 1][0]; // Check if we have updated total value of invoice in previous iterations: if (TotalAmount.get(ParentInvoice.Id) != null) { // if yes, add the current amount of invoice line item to the previous updated invoice object. // Not that, we have not commit to database yet. Hence we are retrieving updated amount from map and not from sobject's Total amount field ParentInvoice.Total_Amount__c = TotalAmount.get(ParentInvoice.Id) + currentInvoiceItem.Amount__c; } else { // We haven't saved total amount in map yet. // Add current invoice line item amount to total amount of invoice object. ParentInvoice.Total_Amount__c += currentInvoiceItem.Amount__c; } // save updated total amount of invoice object in map TotalAmount.put(ParentInvoice.Id, ParentInvoice.Total_Amount__c ); // update invoice object's map. UniqueInvoiceToUpdate.put(ParentInvoice.Id, ParentInvoice); } // iterate UniqueInvoiceToUpdate map to put those invoice objects in list. for (Invoice__c I : UniqueInvoiceToUpdate.values()){ InvoiceToUpdate.add(I); } // update list. update InvoiceToUpdate; } Any better solution?