• kalikota1.3945970503735664E12
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
trigger UpdateAmount1 on Quote__c (after insert, after update) {
List<Opportunity> parentObjList = new List<Opportunity>();
List<Id> listIds = new List<Id>();
List<Quote__c> newQuotes = new Quote[]{};

for (Quote__c childObj : Trigger.new) {
    listIds.add(childObj.Qpp__c);
newQuotes.put(childObj.Qpp__c, Quote__c);
}

parentObjList = [SELECT id,Name FROM Opportunity WHERE ID IN :listIds];

for (Opportunity opp : parentObjList){
    opp.Amount = newQuotes.get(opp.Id).Total_List_Price__c;
}

update parentObjectList;
}