• jahnhy
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Hello,
I have created/copied the below trigger code that updates the "related to" in a task to a contact field that contains the sfdc campaign id. I tried deploying without testing and getting the 75% test level, but it appears as inactive in sfdc. Does anyone knnow what code I could use to test this? What steps would be to test and deploy as active?
Thanks in advance,
 

trigger TaskCampaignAssoc on Task (after insert) {

Task[] taskList = [select whoid, ownerid from Task where id in :Trigger.new and ownerid <>'00530000000vpI1'];

Set<Id> setcontactIds = new Set<Id>();

for(Task task: taskList)

{

setcontactIds.add(task.whoid);

}

Contact[] contactList = [select Latest_Campaign_Response__c from contact where id in :setcontactIds];

List<Task> tasksToUpdate = new List<Task>();

for (integer i=0; i<contactList.size();i++)

{

for (Task t : taskList)

{

t.whatid = contactList[i].Latest_Campaign_Response__c;

tasksToUpdate.add(t);

}

}

update (tasksToUpdate);

}

  • November 11, 2008
  • Like
  • 0
Hello,
I have created/copied the below trigger code that updates the "related to" in a task to a contact field that contains the sfdc campaign id. I tried deploying without testing and getting the 75% test level, but it appears as inactive in sfdc. Does anyone knnow what code I could use to test this? What steps would be to test and deploy as active?
Thanks in advance,
 

trigger TaskCampaignAssoc on Task (after insert) {

Task[] taskList = [select whoid, ownerid from Task where id in :Trigger.new and ownerid <>'00530000000vpI1'];

Set<Id> setcontactIds = new Set<Id>();

for(Task task: taskList)

{

setcontactIds.add(task.whoid);

}

Contact[] contactList = [select Latest_Campaign_Response__c from contact where id in :setcontactIds];

List<Task> tasksToUpdate = new List<Task>();

for (integer i=0; i<contactList.size();i++)

{

for (Task t : taskList)

{

t.whatid = contactList[i].Latest_Campaign_Response__c;

tasksToUpdate.add(t);

}

}

update (tasksToUpdate);

}

  • November 11, 2008
  • Like
  • 0
I finally got Validation/Triggers enabled for Lead Conversion, but now I can't figure out how to code a trigger for it.  I've tried

Code:
trigger test on Lead (after convert) {
}

but I get an Invalid Token error.  There are no hints in the documentation.

thanks
David