• soma s 6
  • NEWBIE
  • 15 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 14
    Replies
Hi
    I am using after update on task , when ever i create new activity i should fire the trigger after update , my test class run but it cover only 44% couldnt find the reason for that. could you please help me

trigger Trigtask on Task(after update) 
{
Set<String> accids = new Set<String>();


    Set<String> taskaccid= new Set<String>();
       Set<String> acountph= new Set<String>();
           string taskacno ;
    
       for(task acc: Trigger.new) 
    {
         List<Task> accListS = [select accountid from task where accountid  IN :accids  AND CallDisposition LIKE '%Lead%'];
            if(accListS != null && !accListS .isEmpty()) 
            {
                taskacno = acc.whatid;
             taskaccid.add(acc.whatid);
           }
           }

      List<Account> accphone = [Select Id,IsPersonAccount,StrPhr_Do_Not_Call_Group_Practice__c, PersonDoNotCall,StrPhr_Lead_Qualified__c  from Account where Phone IN: taskaccid];       
      if(accphone != null && !accphone .isEmpty()) 
            {
             for(Account accph: accphone ) 
{
                              acountph.add(accph.Phone);
           }
    }
   
    if(!acountph.isEmpty()) 
    {
        List<Account> accList = [Select Id,IsPersonAccount,StrPhr_Do_Not_Call_Group_Practice__c, PersonDoNotCall,StrPhr_Lead_Qualified__c  from Account where Phone IN: acountph];        {
            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;
        }
    }
}

test code

@isTest 
public class Tritasktest{

    static testMethod void testMethodOne() 
    {
       
          Account accone = new Account();
        accone .Name='Test Account Two';
        accone .Phone='555555';
        accone .StrPhr_Do_Not_Call_Group_Practice__c = false;
        insert accone ;
        accone .Phone='555555';
                accone .StrPhr_Do_Not_Call_Group_Practice__c = true;
        update accone ;

        Task taskone= new task();
         taskone.whatid= accone .id;
         taskone.CallDisposition ='Leadrep';
                                    insert taskone;
        Account acctwo = new Account();
        accTwo.Name='Test Account Two';
        acctwo.Phone='555555';
        accTwo.StrPhr_Do_Not_Call_Group_Practice__c = false;
        insert accTwo;
        acctwo.Phone='555555';
                accTwo.StrPhr_Do_Not_Call_Group_Practice__c = true;
        update accTwo;

         Task tasktwo= new task();
         tasktwo.whatid= acctwo .id;
         tasktwo.CallDisposition ='Leadrep';
         insert tasktwo;   
         tasktwo.whatid= acctwo.id;
         Task t=[SELECT whatid,CallDisposition FROM Task WHERE whatid=:acctwo.id].get(0);

         tasktwo.CallDisposition='Lead';
          update tasktwo;     
          
              Account acc1 = [select Id,isPersonAccount, StrPhr_Do_Not_Call_Group_Practice__c,phone from Account where Id =: accTwo.Id LIMIT 1];
        System.assertEquals(true, acc1.StrPhr_Do_Not_Call_Group_Practice__c);  
        System.assertEquals('555555', acc1.Phone);  
        
    task acc = [select Id,whatid,accountid, CallDisposition,Account_Ph_No__c from task where whatId =: accone.Id LIMIT 1];
  
      
        System.assertEquals(acc.whatid,accone.id );
         
        



    }
    static testMethod void testMethodTwo() 
    {
        Account accOne = new Account();
        accOne.Name='Test Account One';
        accOne.StrPhr_Do_Not_Call_Group_Practice__c = false;
        accOne.Phone ='5555555555';
        insert accOne;
         

        Account accTwo = new Account();
        accTwo.Name='Test Account Two';
        accTwo.StrPhr_Lead_Qualified__c = false;
        accTwo.Phone ='5555555555';
        accTwo.StrPhr_Do_Not_Call_Group_Practice__c = false;
        accTwo.PersonDoNotCall = false;


        insert accTwo;

        accTwo.StrPhr_Lead_Qualified__c = True;
         accTwo.Phone ='5555555555';
         accTwo.StrPhr_Do_Not_Call_Group_Practice__c = True;
        
          

        update accTwo;

    }



}
hi all
       I have written the below after update trigger on task and also test code, my test code run success but code coverage shows zero percentage could please help me 

Salesforce - Unlimited Editiontrigger Trigtask on Task(after update) 
{
Set<String> accids = new Set<String>();


    Set<String> taskaccid= new Set<String>();
       Set<String> acountph= new Set<String>();
           string taskacno ;
    
       for(task acc: Trigger.new) 
    {
         List<Task> accListS = [select accountid from task where accountid  IN :accids  AND CallDisposition LIKE '%Lead%'];
            if(accListS != null && !accListS .isEmpty()) 
            {
                taskacno = acc.accountid;
             taskaccid.add(acc.accountid);
           }
           }

      List<Account> accphone = [Select Id,IsPersonAccount,StrPhr_Do_Not_Call_Group_Practice__c, PersonDoNotCall,StrPhr_Lead_Qualified__c  from Account where Phone IN: taskaccid];       
      if(accphone != null && !accphone .isEmpty()) 
            {
             for(Account accph: accphone ) 
{
                              acountph.add(accph.Phone);
           }
    }
   
    if(!acountph.isEmpty()) 
    {
        List<Account> accList = [Select Id,IsPersonAccount,StrPhr_Do_Not_Call_Group_Practice__c, PersonDoNotCall,StrPhr_Lead_Qualified__c  from Account where Phone IN: acountph];        {
            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;
        }
    }
}


test code 

Salesforce - Unlimited Edition@isTest 
public class Tritasktest{

    static testMethod void testMethodOne() 
    {
       
          Account accone = new Account();
        accone .Name='Test Account Two';
        accone .Phone='555555';
        accone .StrPhr_Do_Not_Call_Group_Practice__c = false;
        insert accone ;
Task taskone= new task();
                         taskone.whatid= accone .id;
                         taskone.CallDisposition ='Leadrep';
                        // taskone.what=accTwo.id;
             insert taskone;
        Account acctwo = new Account();
        accTwo.Name='Test Account Two';
        acctwo.Phone='555555';
        accTwo.StrPhr_Do_Not_Call_Group_Practice__c = false;
        insert accTwo;
        
         Task tasktwo= new task();
                         tasktwo.whatid= acctwo .id;
                         tasktwo.CallDisposition ='Leadrep';
                        // taskone.what=accTwo.id;
             insert tasktwo;             
                
    task acc = [select Id,accountid, CallDisposition,Account_Ph_No__c from task where whatId =: accone.Id LIMIT 1];
   // Account acc = [select Id, StrPhr_Do_Not_Call_Group_Practice__c from Account where Id =: accTwo.Id LIMIT 1];
   //system.assertequals([select Account_Ph_No__c from task where whatId =:accone.Id],'555555');
      
        System.assertEquals(acc.accountid,accone.id );
//System.assertEquals(acc.name, ‘testName’);

        accTwo.StrPhr_Do_Not_Call_Group_Practice__c = true;
        update accTwo;


//List<Task> accListS = [select accountid from task where accountid  IN :accids  AND CallDisposition LIKE '%Lead%'];

    }
    static testMethod void testMethodTwo() 
    {
        Account accOne = new Account();
        accOne.Name='Test Account One';
        accOne.StrPhr_Do_Not_Call_Group_Practice__c = false;
        accOne.Phone ='5555555555';
        insert accOne;
         

        Account accTwo = new Account();
        accTwo.Name='Test Account Two';
        accTwo.StrPhr_Lead_Qualified__c = false;
        accTwo.Phone ='5555555555';
        accTwo.StrPhr_Do_Not_Call_Group_Practice__c = false;
        accTwo.PersonDoNotCall = false;


        insert accTwo;

        accTwo.StrPhr_Lead_Qualified__c = True;
         accTwo.StrPhr_Do_Not_Call_Group_Practice__c = True;
         //accTwo.PersonDoNotCall = True;

          

        update accTwo;

    }



}
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;
        }
    }
}
My territory assigment rule fire when ever i save the record from UI, but i would like to automate it even if i save the record from back end 
how to do it please advise
Hi
     I want to use SOQL query in apex class and  get the collection ,If the count of collection is morethan one then only i will call the flow , how to do this, i can write Apex class and get collection , it seems i should declare global variable in apex class and set value if the count is greater than one, am i right please advise.
I want to use flow, my requirement is i have account records and have phone number field  in account record, user will update the account record then my flow should collect the account records which has same phone number and update certain field value . how to do in flow, i dont know what to enter in the below screen shot " enter value" please advise.
User-added image
Hi All
           I have a child records ,when i update a field value in a child record and based on certain conditions I would like to update a field value in the remaining child records .
Is it possible to achive by flow.please advise
thanks
soma
 
Could you please advise me how to write test class for below


trigger Dcalup on Account (after update) {

  for (Account myacc : Trigger.old) {
    if (myacc.StrPhr_Do_Not_Call_Group_Practice__c == True) {
      List<Account> Dccall = [SELECT StrPhr_Do_Not_Call_Group_Practice__c from Account where Phone= :myacc.Phone];                
      if (Dccall.size() > 0)        
       for (Account a : Dccall ) {
         a.StrPhr_Do_Not_Call_Group_Practice__c = True;
        update a;
}      
             }                            
    }
  }

I like to place my Report on FTP folder automatically on weekly basis and my report wont exceed 10 MB size, i tried dataloader:io but it didnt help me to schedule on weekly basis, in dataloader i can schedule daily only for free version.My requirement is to place only one report otherwise i go for paid version.
Please suggest me if you have any free tool and some feasible solution.
thanks
soma
Hi
I like to use commandline in dataloader for that i would like to generate password in encrypted bin
i used below command 
C:\Program Files (x86)\salesforce.com\Data Loader> CommandLine DataLoader>encrypt.bat -g YOURSECRETKEY
and i got below error , please advise
2016-03-18 18:15:09,877 INFO  [main] security.EncryptionUtil main (EncryptionUti
l.java:289) - Invalid option format: ûg


thanks
soma
 
hi  
I would like to generate report and place the report on FTP Folder automatically , is it possible, how to do it please advise.
thanks
My territory assigment rule fire when ever i save the record from UI, but i would like to automate it even if i save the record from back end 
how to do it please advise
Hi
    I am using after update on task , when ever i create new activity i should fire the trigger after update , my test class run but it cover only 44% couldnt find the reason for that. could you please help me

trigger Trigtask on Task(after update) 
{
Set<String> accids = new Set<String>();


    Set<String> taskaccid= new Set<String>();
       Set<String> acountph= new Set<String>();
           string taskacno ;
    
       for(task acc: Trigger.new) 
    {
         List<Task> accListS = [select accountid from task where accountid  IN :accids  AND CallDisposition LIKE '%Lead%'];
            if(accListS != null && !accListS .isEmpty()) 
            {
                taskacno = acc.whatid;
             taskaccid.add(acc.whatid);
           }
           }

      List<Account> accphone = [Select Id,IsPersonAccount,StrPhr_Do_Not_Call_Group_Practice__c, PersonDoNotCall,StrPhr_Lead_Qualified__c  from Account where Phone IN: taskaccid];       
      if(accphone != null && !accphone .isEmpty()) 
            {
             for(Account accph: accphone ) 
{
                              acountph.add(accph.Phone);
           }
    }
   
    if(!acountph.isEmpty()) 
    {
        List<Account> accList = [Select Id,IsPersonAccount,StrPhr_Do_Not_Call_Group_Practice__c, PersonDoNotCall,StrPhr_Lead_Qualified__c  from Account where Phone IN: acountph];        {
            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;
        }
    }
}

test code

@isTest 
public class Tritasktest{

    static testMethod void testMethodOne() 
    {
       
          Account accone = new Account();
        accone .Name='Test Account Two';
        accone .Phone='555555';
        accone .StrPhr_Do_Not_Call_Group_Practice__c = false;
        insert accone ;
        accone .Phone='555555';
                accone .StrPhr_Do_Not_Call_Group_Practice__c = true;
        update accone ;

        Task taskone= new task();
         taskone.whatid= accone .id;
         taskone.CallDisposition ='Leadrep';
                                    insert taskone;
        Account acctwo = new Account();
        accTwo.Name='Test Account Two';
        acctwo.Phone='555555';
        accTwo.StrPhr_Do_Not_Call_Group_Practice__c = false;
        insert accTwo;
        acctwo.Phone='555555';
                accTwo.StrPhr_Do_Not_Call_Group_Practice__c = true;
        update accTwo;

         Task tasktwo= new task();
         tasktwo.whatid= acctwo .id;
         tasktwo.CallDisposition ='Leadrep';
         insert tasktwo;   
         tasktwo.whatid= acctwo.id;
         Task t=[SELECT whatid,CallDisposition FROM Task WHERE whatid=:acctwo.id].get(0);

         tasktwo.CallDisposition='Lead';
          update tasktwo;     
          
              Account acc1 = [select Id,isPersonAccount, StrPhr_Do_Not_Call_Group_Practice__c,phone from Account where Id =: accTwo.Id LIMIT 1];
        System.assertEquals(true, acc1.StrPhr_Do_Not_Call_Group_Practice__c);  
        System.assertEquals('555555', acc1.Phone);  
        
    task acc = [select Id,whatid,accountid, CallDisposition,Account_Ph_No__c from task where whatId =: accone.Id LIMIT 1];
  
      
        System.assertEquals(acc.whatid,accone.id );
         
        



    }
    static testMethod void testMethodTwo() 
    {
        Account accOne = new Account();
        accOne.Name='Test Account One';
        accOne.StrPhr_Do_Not_Call_Group_Practice__c = false;
        accOne.Phone ='5555555555';
        insert accOne;
         

        Account accTwo = new Account();
        accTwo.Name='Test Account Two';
        accTwo.StrPhr_Lead_Qualified__c = false;
        accTwo.Phone ='5555555555';
        accTwo.StrPhr_Do_Not_Call_Group_Practice__c = false;
        accTwo.PersonDoNotCall = false;


        insert accTwo;

        accTwo.StrPhr_Lead_Qualified__c = True;
         accTwo.Phone ='5555555555';
         accTwo.StrPhr_Do_Not_Call_Group_Practice__c = True;
        
          

        update accTwo;

    }



}
hi all
       I have written the below after update trigger on task and also test code, my test code run success but code coverage shows zero percentage could please help me 

Salesforce - Unlimited Editiontrigger Trigtask on Task(after update) 
{
Set<String> accids = new Set<String>();


    Set<String> taskaccid= new Set<String>();
       Set<String> acountph= new Set<String>();
           string taskacno ;
    
       for(task acc: Trigger.new) 
    {
         List<Task> accListS = [select accountid from task where accountid  IN :accids  AND CallDisposition LIKE '%Lead%'];
            if(accListS != null && !accListS .isEmpty()) 
            {
                taskacno = acc.accountid;
             taskaccid.add(acc.accountid);
           }
           }

      List<Account> accphone = [Select Id,IsPersonAccount,StrPhr_Do_Not_Call_Group_Practice__c, PersonDoNotCall,StrPhr_Lead_Qualified__c  from Account where Phone IN: taskaccid];       
      if(accphone != null && !accphone .isEmpty()) 
            {
             for(Account accph: accphone ) 
{
                              acountph.add(accph.Phone);
           }
    }
   
    if(!acountph.isEmpty()) 
    {
        List<Account> accList = [Select Id,IsPersonAccount,StrPhr_Do_Not_Call_Group_Practice__c, PersonDoNotCall,StrPhr_Lead_Qualified__c  from Account where Phone IN: acountph];        {
            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;
        }
    }
}


test code 

Salesforce - Unlimited Edition@isTest 
public class Tritasktest{

    static testMethod void testMethodOne() 
    {
       
          Account accone = new Account();
        accone .Name='Test Account Two';
        accone .Phone='555555';
        accone .StrPhr_Do_Not_Call_Group_Practice__c = false;
        insert accone ;
Task taskone= new task();
                         taskone.whatid= accone .id;
                         taskone.CallDisposition ='Leadrep';
                        // taskone.what=accTwo.id;
             insert taskone;
        Account acctwo = new Account();
        accTwo.Name='Test Account Two';
        acctwo.Phone='555555';
        accTwo.StrPhr_Do_Not_Call_Group_Practice__c = false;
        insert accTwo;
        
         Task tasktwo= new task();
                         tasktwo.whatid= acctwo .id;
                         tasktwo.CallDisposition ='Leadrep';
                        // taskone.what=accTwo.id;
             insert tasktwo;             
                
    task acc = [select Id,accountid, CallDisposition,Account_Ph_No__c from task where whatId =: accone.Id LIMIT 1];
   // Account acc = [select Id, StrPhr_Do_Not_Call_Group_Practice__c from Account where Id =: accTwo.Id LIMIT 1];
   //system.assertequals([select Account_Ph_No__c from task where whatId =:accone.Id],'555555');
      
        System.assertEquals(acc.accountid,accone.id );
//System.assertEquals(acc.name, ‘testName’);

        accTwo.StrPhr_Do_Not_Call_Group_Practice__c = true;
        update accTwo;


//List<Task> accListS = [select accountid from task where accountid  IN :accids  AND CallDisposition LIKE '%Lead%'];

    }
    static testMethod void testMethodTwo() 
    {
        Account accOne = new Account();
        accOne.Name='Test Account One';
        accOne.StrPhr_Do_Not_Call_Group_Practice__c = false;
        accOne.Phone ='5555555555';
        insert accOne;
         

        Account accTwo = new Account();
        accTwo.Name='Test Account Two';
        accTwo.StrPhr_Lead_Qualified__c = false;
        accTwo.Phone ='5555555555';
        accTwo.StrPhr_Do_Not_Call_Group_Practice__c = false;
        accTwo.PersonDoNotCall = false;


        insert accTwo;

        accTwo.StrPhr_Lead_Qualified__c = True;
         accTwo.StrPhr_Do_Not_Call_Group_Practice__c = True;
         //accTwo.PersonDoNotCall = True;

          

        update accTwo;

    }



}
Hi
     I want to use SOQL query in apex class and  get the collection ,If the count of collection is morethan one then only i will call the flow , how to do this, i can write Apex class and get collection , it seems i should declare global variable in apex class and set value if the count is greater than one, am i right please advise.
I want to use flow, my requirement is i have account records and have phone number field  in account record, user will update the account record then my flow should collect the account records which has same phone number and update certain field value . how to do in flow, i dont know what to enter in the below screen shot " enter value" please advise.
User-added image
Hi All
           I have a child records ,when i update a field value in a child record and based on certain conditions I would like to update a field value in the remaining child records .
Is it possible to achive by flow.please advise
thanks
soma
 
Could you please advise me how to write test class for below


trigger Dcalup on Account (after update) {

  for (Account myacc : Trigger.old) {
    if (myacc.StrPhr_Do_Not_Call_Group_Practice__c == True) {
      List<Account> Dccall = [SELECT StrPhr_Do_Not_Call_Group_Practice__c from Account where Phone= :myacc.Phone];                
      if (Dccall.size() > 0)        
       for (Account a : Dccall ) {
         a.StrPhr_Do_Not_Call_Group_Practice__c = True;
        update a;
}      
             }                            
    }
  }