The role of environment in infrared surveys: from supernovae to clusters