function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
Can you please write done few line of code, after that we can help with you if you have any stuck point
set<id> setid = new set<id>();
for(Account act : Trigger.new)
{
setid.add(act.Id);
integer concount = [select count() from Contact where AccountId in: setid];
if(act.No_of_Contacts__c > concount){
system.debug('after increment equal' +act.No_of_Contacts__c );
decimal createcontacts = act.No_of_Contacts__c - concount;
system.debug('count of contacts' +concount);
for(integer i=0 ; i<createcontacts; i++){
List <contact> conlist = new List<contact>();
contact con = new contact();
con.LastName = act.Name;
con.AccountId = act.id;
conlist.add(con);
insert conlist;
}
}
}
}