Checking the condition in Inbound action that "sender email matches internal_user.email"

Anandhi Benita
Tera Contributor

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

 

AnandhiBenita_0-1676266540274.png

 

 

Thanks in Advance,

Benita R

1 REPLY 1

Sangeetha Harin
Tera Contributor

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.