In my company we are using Oppotunity standard object and we have created a custom Quote object. The opportunity object is the parent and Quote is the child. How has to be the trigger in order to update the Amount Opportunity value with the Amount Quote Value?
I´m new with Apex and it will be very usefull has some APEX code to do this.
I have reuse some trigger example and it has to be something similar to:
trigger UpdateAmount on Quote__c (after insert) {
List<Opportunity> parentObjList = new List<Opportunity>();
List<Id> listIds = new List<Id>();
for (Quote__c childObj : Trigger.new {
listIds.add(childObj.Opportunity);
}
parentObjList = [SELECT id,Name,(SELECT ID, Total_List_Price__c FROM Quote__r) FROM Opportunity WHERE ID IN :listIds];
for (Opportunity opp : parentObjList){
for (Quote__c quote: Opportunity.Quote__r){
opp.Amount = quote.Total_List_Price__c;
{
{
update parentObjectList;
}
Thanks