You need to sign in to do that
Don't have an account?
mallikharjunarao gunda
triggers change the recordowner if deacivate the user
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 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)){
}
}
}
}
How to identify "records will be higher in payment__c object".