Conditions in Inbound Action

KARAN24
Tera Contributor

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

1 ACCEPTED SOLUTION

sushantmalsure
Mega Sage
Mega Sage

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
}
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,Sushant Malsure

View solution in original post

4 REPLIES 4

sushantmalsure
Mega Sage
Mega Sage

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

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,Sushant Malsure

Ahmmed Ali
Mega Sage

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

If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct!!

Thank you,
Ali

sushantmalsure
Mega Sage
Mega Sage

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
}
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,Sushant Malsure

thanks bro