+ Start a Discussion
ZoomzoomZoomzoom 

Creating CaseMilestone and CaseHistory in a test method

All,

 

I'm trying to write a test method in Apex v25 without seeing pre-existing data, i.e. I have to create my own data.

 

If I was able to create Accounts and Cases, I have a problem creating CaseMilestone and CaseHistory records. I can explicitly create such records, but fields such as CaseMilestone.CaseId or CaseHistory.newValue cannot be updated in apex.

 

CaseMilestones don't seem to be created at case creation (at least I can't see any). And updating tracked fields on the case doesn't seem to create a CaseHistory record.

 

Any idea?