Buy for commodity processes. Build where your process is your advantage.
If a process is the same in every company in your industry, use a product. Accounting is a good example.
If a process is how you win customers, custom software can be worth it, provided you can maintain it.
Many companies land on a hybrid: a standard platform with a small number of well-built extensions.