Inbound email action in HR Case Management is not working for Non-Allowed list of users.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2024 11:14 AM
Hi Team,
We have a requirement to create a inbound email action in HR Case Management.
Requirement:- If a user sends a mail to company123@gmail.com then if the user is not in the allowed list then the user should get a Rejection Email, but it was not working as expected, we need your help to fix this issue asap. Thanks!
Regards,
Govind Varma T.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2024 11:04 AM
Hi @GovindaVarma ,
You need to create inbound action similar to below script to achieve this
(function runInboundEmailAction(email, email_action, event) {
var senderEmail = email.origemail; // Get the sender's email address
// Check if the sender is in the "Allowed Users" table
var allowedUser = new GlideRecord('x_your_scope_allowed_users'); // Replace with your table's sys_id
allowedUser.addQuery('email_address', senderEmail);
allowedUser.query();
if (!allowedUser.next()) {
// Send rejection email
var gr = new GlideEmailOutbound();
gr.setSubject("Access Denied");
gr.setBody("Your email was not processed because you are not on the allowed list.");
gr.setTo(senderEmail);
gr.insert();
}
})(email, email_action, event);