Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. trigger UpdateQLIs on Quote (before update) {
  2.  
  3. list<id> qids=new list<id>();
  4. for(Quote q:trigger.new)
  5. {
  6. Quote OldObj=trigger.OldMap.get(q.id);
  7. if(q.Total_Number_of_System_Groups__c != oldobj.Total_Number_of_System_Groups__c)
  8. qids.add(q.id);
  9. }
  10. System.debug('quote ids '+qids);
  11. list<QuoteLineItem> qlis=[select id, quoteID from QuoteLineItem where quoteID in: qids];
  12. System.debug('qlis '+qlis);
  13. for(quote q:trigger.new)
  14. {
  15. for(quoteLineItem qli:qlis)
  16. {
  17. if(qli.quoteID==q.id)
  18. {
  19. qli.Markup_Percent__c=q.Total_Number_of_System_Groups__c;
  20. update qli;
  21. }
  22. }
  23. }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement