Checking the condition in Inbound action that "sender email matches internal_user.email"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2023 09:39 PM
Hello Everyone
I have created a inbound action for accept or reject a proposed solution via email.
In that, I need a condition that "sender email matches internal_user.email". where internal_user is the end user(Sender) who is replying for the email. It Might be able to add that check in condition line without need for a new script include.
What I have written in the condition is, ((new CSEMailUtil).isUserExist(email.from)) && email.from==current.internal_user.email
Thanks in Advance,
Benita R
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2023 06:08 AM
Hi Anandhi,
You condition will fail, since the sender is neither customer nor authorized user. So add one more function inside the script include to check if the user is internal user.
Update the isUserExist function with below code
return this._isCustomerExist(email_from) || this._isAuthorizedContributorExist(email_from) || _isInternalUserExist: function(email_from);
Create a below function:
_isInternalUserExist: function(email_from) {
var gr = new GlideRecord('sys_user');
gr.addQuery('email',email_from);
gr.query();
if(gr.next()) {
if((new global.CSHelper()).userHasRole(gr.sys_id,'snc_internal')){
return true;
}
}
return false;
},
NOTE: This will impact to all inbound action where ever this function being called.
Make this as correct, if it solves your issue.