You need to sign in to do that
Don't have an account?
Help with test method for trigger
I need help with the test method of this trigger, can someone please help me with the code, the trigger works but do not know how to create the test methods to deploy it to production:
Thank you!
The trigger is:
trigger CopyAttachments on MileStone__c(after insert)
{
Attachment[] attList = [select id, name, body from Attachment where ParentId = :Trigger.new[0].Opportunity__c];
Attachment[] insertAttList = new Attachment[]{};
for(Attachment a: attList)
{
Attachment att = new Attachment(name = a.name, body = a.body, parentid = Trigger.new[0].id);
insertAttList.add(att);
}
if(insertAttList.size() > 0)
{
insert insertAttList;
}
<div>
</div>
All Answers
Have you read this article on writing test methods?
http://wiki.developerforce.com/index.php/An_Introduction_to_Apex_Code_Test_Methods
<div>
</div>
Hi Depton,
In above test class please add any other required field that you have on MileStone__c or Opportunity objects
Thanks
Shashikant Sharma