I want a pop up alert if account create with simillar name?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2024 05:02 AM
Hi All,
Actually i have a requirement that i have Account form, on that name field with string field, so whenever user will create new record if he type similar name which already exist . example Asian Paints is one account,
1.so if he wants create with same name then it won't submit a record
2. second senario was " Asian paints" , if he type something simillar like Asian or Paints , then it pop up a alert message saying " already a record exist similar name , do you want proceed?, if he click ok it save otherwise , will update new name
Please help me to achieve this
Thanks
Deepika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2024 09:26 PM
Thanks for the resonse
I tried this , form getting saved with that name , it doesnot prevent the submission
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2024 12:28 AM
@Amit Gujarathi @Service_RNow @Sumanth16 @Dr Atul G- LNG
I have written this code
Script include
var accontnameinfo = Class.create();
accontnameinfo.prototype = Object.extendsObject(AbstractAjaxProcessor, {
accountname: function() {
var input = this.getParameter('sysparm_account');
var userGR = new GlideRecord('customer_account');
userGR.addQuery('name','CONTAINS', input);
userGR.query();
if (userGR.next()) {
return true;
}
},
type: 'accontnameinfo'
});
Client Script
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
var ga = new GlideAjax('accontnameinfo');
ga.addParam('sysparm_name', 'accountname');
ga.addParam('sysparm_account', newValue);
ga.getXMLAnswer(dosomething);
function dosomething(response) {
var answer = response;
if (answer) {
alert(' Account with simillar name already exists, Please create different one');
}
}
}
This code working , it check the the simillar name and giving a pop up alert, in this i want add one more thing like if new name exactly same with exist one i need to pop up and clearing the value and making that field mandatory
Please help me on this
Thanks
Deepika