- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2016 02:26 PM
Is it possible to modify ServiceNow to impersonate a different user rather than the guest account when triggering inbound actions?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2016 07:21 AM
Hi Tony,
What you can do instead is place a (Before) Business Rule on [sys_email] with conditions of "Type is Received" and "UserID is Guest", and have it update the email message record before insert to use your customized guest user instead for user_id (or whichever field is the user reference on [sys_email]).
Then your unknown senders will get processed as the new guest account without your IEA knowing the difference.
Give that a try, I say.
-Brian

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2016 11:28 PM
Hi Tony,
Listen not to the nay-sayers... There is definitely a way to do it, I initially used this same thing for our Inbound Email Action to check the original sender on unrecognized emails (logged under the Guest account) and if I could identify them, impersonate that user before the Inbound action continued. This isn't how we run it now, but the concept works.
The code you need is relatively simple:
var userId = (find some user sys_id);
var session = gs.getSession();
session.impersonate(userId);
Sorry, I saw your post earlier from home and wanted to answer, but this was code from a year ago buried somewhere at work on my computer.
Hope that works for you,
-Brian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2016 01:02 AM
Hello Brian,
I am the other Tony...
It might depend on what Tony S wants to do.
Adding code in the inbound action could match Tony S's use case or maybe Berny's quick hack (in sub prod ideally) would suit better.
I guess Tony S will drop by later and give feedback - hope so ...
Best Regards
Tony

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2016 01:37 AM
Yeah... to me it didn't sound like he was looking to impersonate a user for testing purposes. IEAs impersonate the user associated with the email record, and for unrecognized senders that's Guest.
To me it sounded like he was trying to customize that behavior. (I think it sounded so to me because that's what I'd been looking to do before)
But like you say, we'll find out.
-Brian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2016 06:24 AM
Thanks for the reply's everyone. We actually have our Guest account inactive so the inbound actions are being skipped altogether. Because ServiceNow won't allow us to rename the user id of the guest account, we had to deactivate it. What I was wondering is if we could create a new guest account with a different userid and have that account be impersonated by the system to execute inbound actions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2016 06:43 AM
Thanks Tony! That's an interesting scenario.
You could take an approach like the one is described in the solution of following thread:
"Check for Inactive User" Before Business Rule
Thanks,
Berny