The simple answer to that is if an assembly is enclosed in a housing that provides primary protection, a conformal coating is often used to add to the protection. On the other hand, where the housing is not capable of providing primary protection to the assembly, a resin might be a better choice.