Need a pop up alert when we create a account with same or simillar name?

Ramu6
Tera Contributor

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 

Ramu6_0-1708409882506.png

 

Please help me sort out this

 

Thanks 

Ram

9 REPLIES 9

Jaspal Singh
Mega Patron
Mega Patron

Hi Ram,

You can simply create a before insert BR on the Account table and allow/abort action accordingly. Kindly share what is that is you have tried and what you are stuck with.

@Jaspal Singh 

Thanks for the response

I didn't start anything , so can you please provide me the code for that

 

Thanks

Ram

Tai Vu
Kilo Patron
Kilo Patron

Hi @Ramu6 

Require unique values for a field

The system allows you to require that a field's values be unique. When this is done, the system will not let two records have the same value for that field.

By default, fields are created without this constraint. A field can have unique values only if there aren't already duplicate values in the database for that field. The system doesn't allow you to make a field unique while there are duplicate values in the table.

The system also doesn't allow you to add a unique index if a non-unique index already exists. In this scenario, you can't select the Unique check box on the form; instead, the system directs you to the Tables & Columns module, so you can drop the non-unique index, and then create the unique index.

Procedure

  1. Verify that no records in the table for the field have values, or that they all have the same value.
  2. Right-click the field label in the form and select Configure Dictionary.
  3. Configure the form to add the Unique field if it does not already appear.
  4. Select the Unique check box.
  5. Update.
Cheers,
Tai Vu
 
 
 
 
 
 
 

Sohail Khilji
Kilo Patron
Kilo Patron

Hi @Ramu6 ,

 

You can create a before insert business rule which checks if the user name already exisit before record insertion...

 

When to run :

Before Insert > with no filter condition.

 

Script :

var cr_name = new GlideRecord('sys_user');
cr_name.addQuery('name', current.name);
cr_name.query(); // you can also use cr_name.getRowCount() to see if its more than 1
if(cr_name.next()){
current.setabortAction(true);
//add error message if needed...
}

 

I hope this helps...

 

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect