• Raghuveer
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 5
    Replies

hi,

 

i have created one Apex Trigger under Task section, that is working fine in sandbox account. when i am trying to deploy the same Trigger in to production, i am getting "Average test coverage across all Apex Classes and Triggers is 72%, at least 75% test coverage is required". i am using Eclipse for deployment.

 

my Requirement is upon clicking save buttion on new Task page, i need to fire an trigger to get last completed task comments to merge with the current comments.

 

 

Here is the my Trigger:

 

trigger Update_Comments_Task on Task (before insert) {

 

List<Id> whoIds = new List<Id>();

 

for(Task oTask : Trigger.new){

whoIds.add(oTask.WhoId);

}

 

//Get Existing Tasks

List<Task> exTask =[select Id,Description from Task where WhoId in :whoIds and status = 'Completed' Order by CreatedDate Desc];

 

for(Task oTask : Trigger.new){

if(exTask.Size() > 0){

for(Task tmpTask:exTask){

if(oTask.Description!=null && tmpTask.Description!=null){oTask.Description = tmpTask.Description +

'\n' + oTask.Description;

}

else if(oTask.Description==null && tmpTask.Description!=null){

oTask.Description = tmpTask.Description;

}

else if(oTask.Description!=null && tmpTask.Description==null){

oTask.Description = oTask.Description;

}

else{oTask.Description = '';

}

break;

}

}

 

}

}

 

 

the above Trigger is working fine in sandbox account.

Can you please help me, how can i improve my test  coverage percentage to 75%.


hi,

 

i need to display the Lead Phone number or Email in the New Task Detail page. Upon clicking the New Task button under Open Activities section of Lead, i need to display the Lead Phone number / Email in one custom filed in the New Task Detail page.  please suggest me any one on this.

 

Thanks

Raghuveer

hi,

 

i need to display the Lead Phone number or Email in the New Task Detail page. Upon clicking the New Task button under Open Activities section of Lead, i need to display the Lead Phone number / Email in one custom filed in the New Task Detail page.  please suggest me on this.

 

Thanks

Raghuveer

hi,

 

my requirement is, needs to display previous added task comments while adding new task under Lead.

i am new to the Salesforce.com. do i need to add Triggers or have any other method. please help me on this.

 

hi,

 

i have created one Apex Trigger under Task section, that is working fine in sandbox account. when i am trying to deploy the same Trigger in to production, i am getting "Average test coverage across all Apex Classes and Triggers is 72%, at least 75% test coverage is required". i am using Eclipse for deployment.

 

my Requirement is upon clicking save buttion on new Task page, i need to fire an trigger to get last completed task comments to merge with the current comments.

 

 

Here is the my Trigger:

 

trigger Update_Comments_Task on Task (before insert) {

 

List<Id> whoIds = new List<Id>();

 

for(Task oTask : Trigger.new){

whoIds.add(oTask.WhoId);

}

 

//Get Existing Tasks

List<Task> exTask =[select Id,Description from Task where WhoId in :whoIds and status = 'Completed' Order by CreatedDate Desc];

 

for(Task oTask : Trigger.new){

if(exTask.Size() > 0){

for(Task tmpTask:exTask){

if(oTask.Description!=null && tmpTask.Description!=null){oTask.Description = tmpTask.Description +

'\n' + oTask.Description;

}

else if(oTask.Description==null && tmpTask.Description!=null){

oTask.Description = tmpTask.Description;

}

else if(oTask.Description!=null && tmpTask.Description==null){

oTask.Description = oTask.Description;

}

else{oTask.Description = '';

}

break;

}

}

 

}

}

 

 

the above Trigger is working fine in sandbox account.

Can you please help me, how can i improve my test  coverage percentage to 75%.

hi,

 

i need to display the Lead Phone number or Email in the New Task Detail page. Upon clicking the New Task button under Open Activities section of Lead, i need to display the Lead Phone number / Email in one custom filed in the New Task Detail page.  please suggest me on this.

 

Thanks

Raghuveer

I have a s-control button that creates a new task when clicked. I also want it to auto populate a custom picklist field when the task is created.

 

The code I have written is below, does anyone know what code I need to include to populate a custom field via this s-control? If this is not possible do you have any other suggestions?

 

 

/00T/e?followup=1&title=Call&retURL=%2F{!Contact.Id}&who_id={!Contact.Id}&what_id={!Account.Id}&tsk5=Left+Voice+Mail&tsk6=Left+a+voicemail+for+{!Contact.Name}

 

&tsk5_fu=Give+{!Contact.Name}+at+{!Account.Name}+a+followup+call&tsk4_fu={!TODAY()+2}&save=x

 

 

Also, is there any specific reason I would want to do this with apex code rather than an s-control, if so any tips on how to get started. I have yet to implement any serious Apex code.

 

 

Thanks!