Client Script for Duplicate Contacts

cboyd12
Tera Contributor

Hello,

I am trying to create a client script targeting the customer_contact table to prevent contacts from being created with the same email address as another contact. However, the script below is not working and I feel sure I am just missing something. Any thoughts?

1 ACCEPTED SOLUTION

ahefaz1
Mega Sage

@cboyd12 ,

 

ServiceNow recommends against using glideRecord in client scripts. I would advise implementing this logic in a before insert business rule.

GlideRecord - Global (servicenow.com)

 

Additionally, in the client script, after the "throw new error" line, there is no "return false." Please add "return false" after it and check if that resolves the issue with the client script.

 

Please mark helpful or accept solution.

Thanks,

 

View solution in original post

2 REPLIES 2

ahefaz1
Mega Sage

@cboyd12 ,

 

ServiceNow recommends against using glideRecord in client scripts. I would advise implementing this logic in a before insert business rule.

GlideRecord - Global (servicenow.com)

 

Additionally, in the client script, after the "throw new error" line, there is no "return false." Please add "return false" after it and check if that resolves the issue with the client script.

 

Please mark helpful or accept solution.

Thanks,

 

cboyd12
Tera Contributor

Ah okay, thanks for the feedback and resource!

Thanks!