You need to sign in to do that
Don't have an account?
SFDC Learning
need help in Test class in task trigger
for(Task tt :trigger.new)
{
if(tt.whoId!=null && tt.who.Name=='Lead'){
lead=[select id,Fast_Phone__c from Lead where id =:tt.whoId ];
In test class when i am creating lead and insert it id into task . the if condition 'if(tt.whoId!=null && tt.who.Name=='Lead')' is not matching. How to resolve this
Thanks in advance
{
if(tt.whoId!=null && tt.who.Name=='Lead'){
lead=[select id,Fast_Phone__c from Lead where id =:tt.whoId ];
In test class when i am creating lead and insert it id into task . the if condition 'if(tt.whoId!=null && tt.who.Name=='Lead')' is not matching. How to resolve this
Thanks in advance
Who.Name returns the name of the Contact or Lead. I think you want Who.Type, which will return "Contact" or "Lead" based on which you associate.