Monday, 8 November 2010

Testing Apex Triggers

It’s been awhile since my last post but that was primarily due to the Giants winning the World Series last week. Between the in street celebrations and the victory parade I have not found time to even study. That being said everything is over now and I no longer have any excuses to put off my work. So let’s get to it….

Since both Apex triggers have been created we need to start testing them. Begin by going to the Scheduled Invoice table and creating a new Scheduled Invoice. We have two triggers so we will set the ‘Duration’ to two and leave the schedule type as ‘Monthly’.  This will add the two scheduled payments to the scheduled payment list for invoice. At this point the scheduled payment list should only be showing the scheduled payment ID. Before we correct this display issue we will edit each payment by changing the status to ‘Paid’. The invoice should now read ‘Paid in Full’.

By making this simple edit we have highlighted two other issues with our application. Marking payments as ‘Paid’ is more work than needed since we are changing only a single value. This basically means that we never have to go from a Paid Status to Pending or Past due (of course this is theoretically speaking). That being said we should never have to manually mark a payment as late; that should be conducted by the system.

Before we cover automatically marking late payments in the workflow section, we need to correct the display and usability issues. VisualForce pages are utilized to complete these tasks; which we will dive into with the next post.

No comments:

Post a Comment