function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

PLEASE - Point me somewhere where there is a hard example of TESTING TRIGGERS

Please. I got to get my trigger out into production.

Here is an example of how to test a trigger.  The trigger updates the stage on an opportunity when a task is created called 'Request New Media Plan'.

public class TestTrigger { 

        public static testmethod void task_aft_ins() {
        Opportunity opp = new Opportunity(currencyisocode = 'USD', Name= 'Big Sale in US', AccountID = '00120000004pkJlAAI', Type = 'Upsell', CloseDate =, Presentation_Date__c =, StageName = 'Presentation Stage');
        insert opp;
                     Task tsk = new Task(subject = 'Request New Media Plan', ActivityDate =, WhatID = opp.ID);
                      insert tsk;

                      // Check that the trigger properly set the StageName to Proposal Stage
        Opportunity retOpp = [select StageName from Opportunity where];
        System.assertEquals('Proposal Stage', retOpp.StageName);


Are we really getting emoticons in our code? Test: where vs where id=  =0 =o =O

Message Edited by MarioKorf on 04-17-2008 11:33 AM