• Sloan Mana
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies
Hi there, I am very new to Apex coding, and I feel a bit out of my league here, tbh.  I was hoping someone might be able to help me create a Test Class for a Trigger I've created...

I created a trigger on tasks that updates the record type if the task subject contains "Statement Reminder" or "Collection Letter".  Unfortunately, I cannot just use a SF workflow or process to do this because this sort of task is created when a user sends an email out which I guess is a "soft" process that does not activate workflows.  I've copied the code for my trigger below, and it seems to work, but I'm having trouble creating the test class for it.  I'd really appreciate anyone's help!

trigger CollectionTaskRecordType on Task (before insert, before update) {
    for(task t:Trigger.new){
        if(t.Type == 'Email' && t.Subject.contains('Statement Reminder') || t.Type== 'Email' && t.Subject.contains('Collection Letter')){
            (t.RecordTypeId = '01236000000yN92AAE');
        }
    }
}
Hi there, I am very new to Apex coding, and I feel a bit out of my league here, tbh.  I was hoping someone might be able to help me create a Test Class for a Trigger I've created...

I created a trigger on tasks that updates the record type if the task subject contains "Statement Reminder" or "Collection Letter".  Unfortunately, I cannot just use a SF workflow or process to do this because this sort of task is created when a user sends an email out which I guess is a "soft" process that does not activate workflows.  I've copied the code for my trigger below, and it seems to work, but I'm having trouble creating the test class for it.  I'd really appreciate anyone's help!

trigger CollectionTaskRecordType on Task (before insert, before update) {
    for(task t:Trigger.new){
        if(t.Type == 'Email' && t.Subject.contains('Statement Reminder') || t.Type== 'Email' && t.Subject.contains('Collection Letter')){
            (t.RecordTypeId = '01236000000yN92AAE');
        }
    }
}