+ Start a Discussion

BusinessHour Record in Test method.


I am facing one issue with creation of Business hour test data in one of my test method. while inserting businesshour test record it is giving an exception "Save error: DML not allowed on BusinessHours".

If I can't create BusinesssHour record in test method than how do i refer to the busnesshours record for the test coverage.



While you can't create business hours on the fly, you will have a default set of hours in place at all times, so I use that.  It does make the tests slightly artificial in that you can't test the actual advancement of business time without simply executing the addition in your test method.