There's no single right answer, but there is a simple test.
Buy when the process is standard
Accounting, email, chat and payroll work much the same way in most companies. A good SaaS tool will be cheaper and better maintained than anything you build.
Build when the process is your advantage
If the way you handle orders, pricing or service is what sets you apart, forcing it into a generic tool means giving that edge away. That's where custom software earns its cost.
Or connect the two
Often the best answer is both: keep the standard tools and build a thin custom layer that connects them and automates the gaps.