You need to sign in to do that
Don't have an account?
krish@123
Please suggest me getting the record count from contact and update the fields in contact
Hi
Please see the below Trigger
trigger CountFemales1 on Contact (after insert,after update,after delete) {
List<Contact> contacts = Trigger.isdelete ? trigger.old : trigger.new;
Set<Id> accountIds = new Set<Id>();
for (Contact c : contacts) {
if (c.lastname!= null) {
accountIds.add(c.id);
}
}
list<Contact> FemaleList = [select id from contact where id In :accountIds AND Customer_status__c ='buyer broker'];
for(Contact a :FemaleList) {
a.No_of_Converted_Contacts__c= FemaleList .size();
}
update FemaleList ;
}
when I try edit and save the record iam getting below error
Error: Invalid Data.
Please see the below Trigger
trigger CountFemales1 on Contact (after insert,after update,after delete) {
List<Contact> contacts = Trigger.isdelete ? trigger.old : trigger.new;
Set<Id> accountIds = new Set<Id>();
for (Contact c : contacts) {
if (c.lastname!= null) {
accountIds.add(c.id);
}
}
list<Contact> FemaleList = [select id from contact where id In :accountIds AND Customer_status__c ='buyer broker'];
for(Contact a :FemaleList) {
a.No_of_Converted_Contacts__c= FemaleList .size();
}
update FemaleList ;
}
when I try edit and save the record iam getting below error
Error: Invalid Data.
Change this : With this :
this field "No_of_Converted_Contacts__c" msut be a Nmber.