I am new to SFDC Dev and wrote my first trigger, and was hoping to get assistance on my test class.
My trigger is based off of this reference below.
https://developer.salesforce.com/forums/?id=906F00000008yuFIAQ
Here is my code:
trigger FireFighterticketcreatorTrigger on Help_Desk_Ticket__c (after update) {
List<Firefighter__c> ftix = new List<Firefighter__c>();
for (Help_Desk_Ticket__c hd:trigger.new) {
if (hd.OwnerId == '0054D000000RlEB') {
Firefighter__c ff = new Firefighter__c ();
ff.Email_Address__c = hd.Email_Address__c;
ff.EmailFromName__c = hd.EmailFromName__c;
ff.OwnerId = '0054D000000RlEB';
ff.Description__c = hd.Description__c;
ff.Internal_Notes__c= hd.Internal_Notes__c;
ftix.add(ff);
}
}
try {
insert ftix;
} catch (system.Dmlexception e){
system.debug(e);
}
}
Here is my test class:
@isTest(SeeAllData=true)
private class TestFireFighterTickets_createFFticket {
static testmethod void testFireFighter() {
Test.startTest();
Firefighter__c ftix = new Firefighter__c (
Email_Address__c = '[email protected]',
Title__c = 'Test',
EmailFromName__c = 'Wil Deynes'
);
insert ftix;
Test.stopTest();
}
}
Any help is greatly appreciated!