The trial court erred and denied defendant due process by sua sponte changing the plaintiff (from the HOA to its manager) and cause of action (from CCP 527.8 to 527.6) at the end of trial without prior notice. On the other hand, the trial court also erred in holding that 527.8 (workplace violence prevention) did not apply when threats were delivered to the HOA’s manager at his home office rather than the employer’s premises or during times when he had turned from work duties to other activities only temporarily.