• sfdcLion
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
hai hall
i have a customer__c and payment__c objects ,payment__c has lookup to customer__c.
here customer__c object having a one record and payment__c having a ten records out of ten records six records having one user and four records having another user .  all tese records associate to the  customer__C .if i deactive the customer__c record ownerid ,those whose records will be higher in payment__c object that user can be assigned to the customer__c objectrecord

i wrote code something 
trigger userchange on User (after update) {    
    list<customer__c> cust=[select id, first_name__c from customer__c where first_name__c='chanda shekar'];
    list<user> u=[select id from user];
    List<Id>ids=new list<Id>();
    map<Id, list<payment__c>> getRecords=new map<Id, list<payment__C>>();
    Map<Id,Customer__C> customerMap=new Map<Id,Customer__C>([select id,ownerId ,(select id,ownerId from Payments__r) from Customer__c where ownerId in:Trigger.Newmap[0].Id]);
    Map<Id,List<Payment__c> > cusMap=new Map<Id,List<Payment__c>();
    for(Id id:customerMap.keySet()){
        for(Payment__c p:customerMap.get(id).payments__r){
            if(cusMap.keySet().contains(p.ownerId)){
                
            }
        }
    }
    
    }
i want write a trigger on Opportunity,When a Opportunity is 'close won' after that trigger update the related account's Custome Field Sum_of_CloseWon__C ,with the amount of closed won Opportunity 'Amount' Field ..
Thanks in advance. ;)