PLF-5286 SOC-3472 | Notification Emails - Improvement javascript code