User interacts/sends mail to closed HR tasks then it should redirect him to create new case
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2025 05:44 AM
If user tried to interact with closed HR task via email then it should redirect him to create new case.How to achieve this functionality.can someone help me?
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2025 05:49 AM
Hi @ShahidaM
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2025 09:14 AM
Hi @ShahidaM
Did you check these links?
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2025 05:51 AM
you may need to handle email replies to closed HR tasks and redirect to create a new HR case when a user attempts to interact with a closed task.
your email inbound script should be something like this
// Get the HR Task from the email
var hrTaskSysId = email.related_sys_id;
if (hrTaskSysId) {
var hrTask = new GlideRecord('sn_hr_core_task');
if (hrTask.get(hrTaskSysId)) {
if (hrTask.state == 3 || hrTask.state == 4 || hrTask.state == 7) { // Closed states
gs.info("HR Task is closed. Sending redirect email.");
// Construct the HR case creation link
var portalUrl = gs.getProperty("glide.app.service_portal.url");
var createCaseUrl = portalUrl + "/sp?id=sc_cat_item&sys_id=<YOUR_CATALOG_ITEM_SYS_ID>";
// Send email response
var emailUtil = new GlideEmailOutbound();
emailUtil.setSubject("HR Task Closed - Create a New Case");
emailUtil.setBody("The HR task you replied to is closed. If you need further assistance, please create a new HR case here: " + createCaseUrl);
emailUtil.setTo(email.from);
emailUtil.send();
}
}
}
Please mark correct/helpful if this helps you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2025 06:46 AM
Do I need to write Inbound emai on HR task table ?please help if all the details are updated correcctly.