Where is the Guest user define in system?

Harshada Kashid
Kilo Contributor

When email is sent , HR case is getting created in my instance.

But when email is sent via personal email id(gmail.com) then also Hr case is getting created as Opened By value set to "Guest".

I would like to know that where this script is define in system that Opened By field will be "Guest" when user is not present in SNOW(email id not in system/personal email id)?

I checked the inbound email action using which Hr case is getting created but there is no such script define there.

Below is the script from inbound email action.


if (email.importance !== undefined) {
if (email.importance.toLowerCase() == "high")
current.priority = 1;
} else
current.priority = 3;

var bodyText = email.body_text;
if (!bodyText)
bodyText = email.body_html;

current.work_notes = "HR Case created by email:\n\nReceived from: " + email.origemail + "\n\n" + email.subject + "\n\n" + bodyText;
current.description = bodyText;

//Re-direct who gets the case based on recipient:
if(email.recipients.toLowerCase().indexOf(gs.getProperty("sn_hr_core.hr_email").toLowerCase()) > -1){
current.assignment_group="d8620530db2a43000a4c3c8f9d9619c3";
}
else{
current.assignment_group="723aa84f5ba02200502f6ede91f91aea";
}
// Core email rules assign "Guest" if the from email does not match a user.
// In this case, check the HR profile personal email, and reassing the case to that user.
var profile;
if (gs.getUserID() != '5136503cc611227c0183e96598c4f706') { //GUEST SYS_ID

// Find and attach profile if it exists
current.caller_id = gs.getUserID();
current.opened_by = gs.getUserID();
current.opened_for = gs.getUserID();
profile = new GlideRecord('sn_hr_core_profile');
profile.addQuery('user', gs.getUserID());
profile.query();
if (profile.next())
current.hr_profile = profile.sys_id;
}

current.subject_person = current.opened_for;
var newId = current.sys_id;
gs.eventQueue('sn_hr_core_case.email.creation', current, newId, email.from);

8 REPLIES 8

Alberto Consonn
ServiceNow Employee
ServiceNow Employee

Hi,

for any information about guest user, I suggest you to read the following interesting thread, it will clarify your doubt!

What is a guest user?

Please, remember to mark Correct or Helpful if you find my response useful.

Cheers
Alberto

Where is the script define to take untrusted user as a Guest?

I am not able to find that script in my system.

Alikutty A
Tera Sage

Hello,

This is how the inbound actions work by default. Your personal email address is not existing in the instance for any of the active users. So the inbound action is unable to detect a valid user from the instance.

When the instance receives an email, it can take a variety of actions by impersonating the sender.

If the sender of an incoming email matches an existing user, the instance impersonates the matching user to complete any inbound email actions. If the sender does not match an existing user, the instance impersonates the Guest user to complete any inbound email actions. If the impersonated user is locked out , the inbound email action fails.

Note: If inbound email comes from an untrusted domain, the instance impersonates the Guest user unless you explicitly prevent users from untrusted domains from triggering inbound actions.