• Mark Wieland (RF Administrator)
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hi all,

I wrote a fairly simple trigger based on a requirement we have within our company. I am not a code developer, but found a simple example on these forums to modify and it does exactly what I want it to do. However, to bring it to production, I need to create a test class for it and was wondering if you can help me create it. 

This is the trigger I would need a test class for. I would be very grateful if you can help me get the test class created, as we want to move this into production as soon as possible. 
 
trigger DLL_Automation_Task_Trigger on BMCServiceDesk__Task__c (Before update, Before insert) {


     List< BMCServiceDesk__Change_Request__c> lstChangeRequestToUpdate = new List<BMCServiceDesk__Change_Request__c>();
     Map<Id,BMCServiceDesk__Change_Request__c>changeMP;
     for(BMCServiceDesk__Task__c tskobj:trigger.new)
     {
        if((tskobj.BMCServiceDesk__taskType__c=='Automation') && (tskobj.BMCServiceDesk__FKStatus__c=='a2924000000RkGyAAK'))
        {
            lstChangeRequestToUpdate.add(new BMCServiceDesk__Change_Request__c(Id = tskobj.BMCServiceDesk__FKChange__c,
                                                    Automation_Stop__c=true));
        }
     }
     update lstChangeRequestToUpdate;

 
Hi all,

I wrote a fairly simple trigger based on a requirement we have within our company. I am not a code developer, but found a simple example on these forums to modify and it does exactly what I want it to do. However, to bring it to production, I need to create a test class for it and was wondering if you can help me create it. 

This is the trigger I would need a test class for. I would be very grateful if you can help me get the test class created, as we want to move this into production as soon as possible. 
 
trigger DLL_Automation_Task_Trigger on BMCServiceDesk__Task__c (Before update, Before insert) {


     List< BMCServiceDesk__Change_Request__c> lstChangeRequestToUpdate = new List<BMCServiceDesk__Change_Request__c>();
     Map<Id,BMCServiceDesk__Change_Request__c>changeMP;
     for(BMCServiceDesk__Task__c tskobj:trigger.new)
     {
        if((tskobj.BMCServiceDesk__taskType__c=='Automation') && (tskobj.BMCServiceDesk__FKStatus__c=='a2924000000RkGyAAK'))
        {
            lstChangeRequestToUpdate.add(new BMCServiceDesk__Change_Request__c(Id = tskobj.BMCServiceDesk__FKChange__c,
                                                    Automation_Stop__c=true));
        }
     }
     update lstChangeRequestToUpdate;