Need a pop up alert when we create a account with same or simillar name?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2024 10:18 PM
Hi All,
I have requirement that we have an accounts, when the Accounts team wants to create new account , then on the new form if they enter name which already created and trying to save form then there alert or validation should be there , this name already exist
Please help me sort out this
Thanks
Ram
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2024 10:39 PM
Thanks for code
But actually it needs on the Account table not user table, On Account form we have name field, for that i need to check
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2024 11:11 PM
in the code just replace the sys_user table with your table name... its simple
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2024 11:56 PM
I have tried this code , but it not stop the saving the form, Record gets created with that name

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2024 12:06 AM
Hi @Ramu6
you should write before insert business rule on the custom table and then query the table.
Note: Ensure you give correct field names here
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord(current.getTableName());
gr.addQuery("u_account", current.u_account); // give correct field name
gr.addQuery("u_trouble_type", current.u_trouble_type); // give correct field name
gr.addQuery("u_assignment_group", current.u_assignment_group); // give correct field name
gr.setLimit(1);
gr.query();
if (gr.hasNext()) {
gs.addErrorMessage("This is a duplicate record");
current.setAbortAction(true);
}
})(current, previous);
Please mark reply as Helpful/Correct, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2024 01:49 AM
Thanks for the code
Basically here "name field" on the account table was not reference field , its text field
And basically here two things
1. if user enters same name when he create new account it should not allow him and need display error message?
2.If user enter simillar name like example " Indian Times" is one of the existing account so if user try to create simmilar like "Indian " or type "Times" then its needs to alert a pop up saying , "there already simillar name exist, do you want to continue ?, if click ok then save the form or he need to able to change
Thanks
Ram