current caller email id is not allowed to add in the watch list in incident form in ServiceNow

Rajveer
Tera Expert

Hello Experts,

 

current caller email id is not allowed to add in the watch list in incident form in ServiceNow. How to achieved  ?

1 ACCEPTED SOLUTION

AnveshKumar M
Tera Sage
Tera Sage

Hi @Rajveer 

Try the following before business rule.

 

(function executeRule(current, previous /*null when async*/) {
	var watch_list_users = current.getValue('watch_list') + '';
	if(watch_list_users.indexOf(current.caller_id) != -1){
		current.setAbortAction(true);
		gs.addErrorMessage("Caller can not be in watch list users.");
	}

})(current, previous);

 

AnveshKumarM_0-1695798208661.png

 

AnveshKumarM_1-1695798222335.png

 

Please mark my answer helpful and accept as solution if it helped you 👍✔️

Thanks,
Anvesh

View solution in original post

1 REPLY 1

AnveshKumar M
Tera Sage
Tera Sage

Hi @Rajveer 

Try the following before business rule.

 

(function executeRule(current, previous /*null when async*/) {
	var watch_list_users = current.getValue('watch_list') + '';
	if(watch_list_users.indexOf(current.caller_id) != -1){
		current.setAbortAction(true);
		gs.addErrorMessage("Caller can not be in watch list users.");
	}

})(current, previous);

 

AnveshKumarM_0-1695798208661.png

 

AnveshKumarM_1-1695798222335.png

 

Please mark my answer helpful and accept as solution if it helped you 👍✔️

Thanks,
Anvesh