You need to sign in to do that
Don't have an account?
Rahul
Hello friends, Can you help me with The test class of this code.Thanks in advance
trigger updateborrowerinbucket1 on Account (after insert, after update) {
set<id> setid = new set<id>();
list<bucket1__C> bucketlist = new list<bucket1__C>();
for(Account a : trigger.new){
setid.add(a.Bucket_1__c);
}
for(bucket1__c bb : [select id,name,Borrower_Name__c,(select id, name, Mobile_Number__c from Accounts__r)from bucket1__C where id=:setid]){
bucket1__C bb2 = new bucket1__C();
bb2.id=bb.id;
bb2.count_of_patients__c=bb.Accounts__r.size();
bb2.Borrower_Name__c=bb.Accounts__r[0].Name;
bucketlist.add(bb2);
}
update bucketlist;
}
set<id> setid = new set<id>();
list<bucket1__C> bucketlist = new list<bucket1__C>();
for(Account a : trigger.new){
setid.add(a.Bucket_1__c);
}
for(bucket1__c bb : [select id,name,Borrower_Name__c,(select id, name, Mobile_Number__c from Accounts__r)from bucket1__C where id=:setid]){
bucket1__C bb2 = new bucket1__C();
bb2.id=bb.id;
bb2.count_of_patients__c=bb.Accounts__r.size();
bb2.Borrower_Name__c=bb.Accounts__r[0].Name;
bucketlist.add(bb2);
}
update bucketlist;
}
Please use the below code.
Thanks,
Yogesh
All Answers
Please use the below code.
Thanks,
Yogesh