- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2023 08:03 AM
Hi Team,
I have a inbound action,and want to process that only if the sender of the email is present in the user table.
Can anyone help me ,how cam I apply this condition in my Inbound action.
Any help would be appreciated.
Regards,
Karan
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2023 08:21 AM
and if you dont want to deactivate guest user for whatever reasons then you can include following script in action of inbound actions at the beginning of script:
var checkUser = new GlideRecord('sys_user');
checkUser.addQuery('email',email.from);
checkUser.query();
if(!checkUser.next()){
event.state="stop_processing";
}
else{
//rest processing of your inbound action script
}
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2023 08:13 AM
try deactivating the guest user from sys_user table and that way inbound action will not be present if user is not found in servicenow
Regards,Sushant Malsure

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2023 08:15 AM
Hello @KARAN24 ,
You can simply create inbound action with any other conditions and in script as below to check if user is guest, which means sender email did not match any user record in ServiceNow.
script:
if(gs.getUserName() == "guest"){
return;
}else{
//Write your script here
}
Thanks,
Ali
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2023 08:21 AM
and if you dont want to deactivate guest user for whatever reasons then you can include following script in action of inbound actions at the beginning of script:
var checkUser = new GlideRecord('sys_user');
checkUser.addQuery('email',email.from);
checkUser.query();
if(!checkUser.next()){
event.state="stop_processing";
}
else{
//rest processing of your inbound action script
}
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2023 03:53 PM
thanks bro