• KevinA.ax1880
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 9
    Replies

I am now onto unit testing my class called from a trigger that I got help with a few weeks back. As you all know, I need to have unit tests proving successful coverage of my code.  From the help & online, I figured out how to setup Eclipse & the Force.com IDE.

 

Currently, I am connected to our sandbox:

 

Here is the trigger.  it calls a method in a class:

trigger ReportPackageTrigger on Report_Package__c (after update) {
      ReportPackageHelper.flagRecipientsAsDeleted(trigger.oldMap,trigger.newMap);
}

 

 

I created a 'test' class, and from the help, I discerned that I need to create & reference instances of the objects that will be used to initiate an update event.  I am quite new to the SF paradiagm being more familiar with .Net methods, but am muddling my way through.  I need allot of help with the concept's implementation of how to properly set up a unit test with appropriate coverage.  In SANDBOX This is what I have so far, but it is incomplete, I know.  Would anyone be able to steer me in the right direction on how to build a caompleted unit test?  Additional resources would also be welcomed!

 

 

@isTest
private class UnitTestClass {

    static testMethod void TestEndDatingPkg() {
      //Comment: Set up a dummy Package recipient with today as the start date.
      Package_Recipient__c PackRecp = new Package_Recipient__c(Contact_Name__c='Albrecht',Start_Date__c=Date.today());
      insert PackRecp;
      //Comment: Set up a dummy Package with no end date.
      Report_Package__c RepPkg = new Report_Package__c(name='ABC Package');
      insert RepPkg;

 

//I need to now associate the recipient with the package, assign a date to a field, which will be an event that I will catch in my class code.
      
        
        
        
        
        
    }
}

 

Hi,

 

I am very new to APEX, and am trying different ways to raise an error to my users.  In the current situation, I am attempting to prevent a user from removing/clearing out a date field, once they have set a date. 

 

I received some help originally to manipulate child records, created in a class object which I have extended for some validation in which I have a custom exception working that raises an error to the user displayed at the top of the form.

 

The problem with this option (that I can see) is that it throws an exception with allot of additional language included.  I remember in my administration clas they mentioned raising errors attached to a specific field, but for the life of me cannot come up with a solution.

 

Does anyone have a specific example they could share that could be used as a validation step that raises a custom message on a specific field?

 

 - Thanks, Kevin

Hi, We are just getting started with SalesForce, and I am a developer proficient in .Net & SQL, I am having a hard time finding examples for updating child records of a custom object when it has it's status updated. I believe a trigger are what I am looking for, but the examples I am finding are all very generic. I would like some help in how to reference current the record's ID and how to perform an update of related child records. The two paradiagms I am familiar with are vb.net recordsets & SQL updates. I am literally starting with nothing: trigger trDeleteRelatedRecipients on Report_Package__c (after update) { } Any help would be greatly appreciated!

Hi,

 

I am very new to APEX, and am trying different ways to raise an error to my users.  In the current situation, I am attempting to prevent a user from removing/clearing out a date field, once they have set a date. 

 

I received some help originally to manipulate child records, created in a class object which I have extended for some validation in which I have a custom exception working that raises an error to the user displayed at the top of the form.

 

The problem with this option (that I can see) is that it throws an exception with allot of additional language included.  I remember in my administration clas they mentioned raising errors attached to a specific field, but for the life of me cannot come up with a solution.

 

Does anyone have a specific example they could share that could be used as a validation step that raises a custom message on a specific field?

 

 - Thanks, Kevin

Hi, We are just getting started with SalesForce, and I am a developer proficient in .Net & SQL, I am having a hard time finding examples for updating child records of a custom object when it has it's status updated. I believe a trigger are what I am looking for, but the examples I am finding are all very generic. I would like some help in how to reference current the record's ID and how to perform an update of related child records. The two paradiagms I am familiar with are vb.net recordsets & SQL updates. I am literally starting with nothing: trigger trDeleteRelatedRecipients on Report_Package__c (after update) { } Any help would be greatly appreciated!