You need to sign in to do that
Don't have an account?

test class for task object
Hi
I am trying hard to write test class for the below
trigger Activitytri on Task(after update)
{
Set<String> accids = new Set<String>();
Set<String> phoneStrSet = new Set<String>();
string taskacno ;
for(task acc: Trigger.new)
{
taskacno = acc.accountid;
accids .add(acc.Account_Ph_No__c);
List<Task> accListS = [select accountid from task where accountid IN :accids AND CallDisposition LIKE '%Lead%'];
if(accListS != null && !accListS .isEmpty())
{
phoneStrSet.add(acc.Account_Ph_No__c);
}
}
if(!phoneStrSet.isEmpty())
{
List<Account> accList = [Select Id,IsPersonAccount,StrPhr_Do_Not_Call_Group_Practice__c, PersonDoNotCall,StrPhr_Lead_Qualified__c from Account where Phone IN: phoneStrSet ]; {
for(Account acc: accList)
{
if ( acc.IsPersonAccount == true && acc.StrPhr_Do_Not_Call_Group_Practice__c == False && acc.ID ==taskacno )
{
acc.StrPhr_Do_Not_Call_Group_Practice__c=True;
//acc.PersonDoNotCall = True;
}
if ( acc.IsPersonAccount == true && acc.StrPhr_Do_Not_Call_Group_Practice__c == False && acc.ID !=taskacno )
{
acc.StrPhr_Do_Not_Call_Group_Practice__c=True;
acc.PersonDoNotCall = True;
}
}
update accList;
}
}
}
I am trying hard to write test class for the below
trigger Activitytri on Task(after update)
{
Set<String> accids = new Set<String>();
Set<String> phoneStrSet = new Set<String>();
string taskacno ;
for(task acc: Trigger.new)
{
taskacno = acc.accountid;
accids .add(acc.Account_Ph_No__c);
List<Task> accListS = [select accountid from task where accountid IN :accids AND CallDisposition LIKE '%Lead%'];
if(accListS != null && !accListS .isEmpty())
{
phoneStrSet.add(acc.Account_Ph_No__c);
}
}
if(!phoneStrSet.isEmpty())
{
List<Account> accList = [Select Id,IsPersonAccount,StrPhr_Do_Not_Call_Group_Practice__c, PersonDoNotCall,StrPhr_Lead_Qualified__c from Account where Phone IN: phoneStrSet ]; {
for(Account acc: accList)
{
if ( acc.IsPersonAccount == true && acc.StrPhr_Do_Not_Call_Group_Practice__c == False && acc.ID ==taskacno )
{
acc.StrPhr_Do_Not_Call_Group_Practice__c=True;
//acc.PersonDoNotCall = True;
}
if ( acc.IsPersonAccount == true && acc.StrPhr_Do_Not_Call_Group_Practice__c == False && acc.ID !=taskacno )
{
acc.StrPhr_Do_Not_Call_Group_Practice__c=True;
acc.PersonDoNotCall = True;
}
}
update accList;
}
}
}