• Rachel Z.
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies
Hi All,

I am new to writing code and need help creating a test class. I can't seem to get it quite right.

The following is my trigger:


trigger AfterDelete on Opportunity (after delete) 
{
    List<Scratch_Object__c> so = new List<Scratch_Object__c>();
    for(Opportunity o : Trigger.old)
    {
        Scratch_Object__c s = new Scratch_Object__c();
        s.Name = o.Name;
        s.Demo_Date_Time__c = o.Set_Demo_Appt_Date_Time__c;
        s.Dealership__c = o.accountid;
        // etc.

        so.add(s);
    }

    insert so;
}

Please Help!
Hi All, I have a validation rule that I would like to create on the campaign stating that a particular field cannot be changed if the campaign has more than 0 leads or opportunities created from it. It wasn't letting me use the standard fields on the campaign so I created my own custom formula adding leads and  opportunities together but I still keep getting the same error.

This is my what seems to be very simple validation rule that will not work.

Total_Inquiries_and_Proposals__c >0

The following is the error I receive:

Error: Error in referenced formula Total_Inquiries_and_Proposals__c, Field NumberOfLeads may not be used in this type of formula