• JGreory
  • NEWBIE
  • 0 Points
  • Member since 2010

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

I've written a simple Apex Trigger to change the Opportunity Type based upon the Opportunity Record Type. Works fine in the Sandbox so now it's time to deploy and I could use some help.

 

I created an outbound change set in the Sandbox and uploaded it into my Production site where it was deployed. However, it's stuck "In Progress".

 

So I created an Eclipse project and added an Apex Trigger there. But it fails in testing when i try to deploy it to the server. I've got no clue how to write a proper test for this and so far what I've found here and via Google is a bit confusing.

 

Here's the trigger code:

 

 

trigger recordtype on Opportunity (before update) { Opportunity myOpportunity = trigger.new[0]; if (myOpportunity.RecordTypeID == '012A0000000L9p0' && myOpportunity.Type <> 'New Agent or Agency') { myOpportunity.Type = 'New Agent or Agency'; } else if (myOpportunity.RecordTypeID == '012A0000000L9oW' && myOpportunity.Type <> 'Life Insurance') { myOpportunity.Type = 'Life Insurance'; } else if (myOpportunity.RecordTypeID == '012A0000000L9ol' && myOpportunity.Type <> 'Critical Illness') { myOpportunity.Type = 'Critical Illness'; } else if (myOpportunity.RecordTypeID == '012A0000000L9ov' && myOpportunity.Type <> 'Deferred Annuity') { myOpportunity.Type = 'Deferred Annuity'; } else if (myOpportunity.RecordTypeID == '012A0000000L9og' && myOpportunity.Type <> 'Disability') { myOpportunity.Type = 'Disability'; } else if (myOpportunity.RecordTypeID == '012A0000000L9ob' && myOpportunity.Type <> 'Long Term Care') { myOpportunity.Type = 'Long Term Care'; } else if (myOpportunity.RecordTypeID == '012A0000000LAzh' && myOpportunity.Type <> 'Managed Concept') { myOpportunity.Type = 'Managed Concept'; } else if (myOpportunity.RecordTypeID == '012A0000000L9oq' && myOpportunity.Type <> 'SPIA') { myOpportunity.Type = 'SPIA'; } }

 

 

 

  • February 16, 2010
  • Like
  • 0

Anyone know if the Spring 10 rollout delay means that the Spring IDE update will be pushed back from Feb 15th?

 

Thanks

David