- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2017 11:55 AM
We have users that are constantly adding New CIs/Phone Numbers and having an issue with duplicate phone #s being added because those are simply not being checked consistenly to see if it already exists. What is the best way to prevent this creation of duplicate phone#s? Business rule, etc? We are looking more in the lines of having a flag or something where once the # is saved, it prompts that "this # already exists" and denies the creation of the new #.
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2017 11:45 PM
Hi Eddie,
Sorry, it is supposed to be gs.addErrorMessage() and not current.addErrorMessage().
Here is the complete script:
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('u_phone_numbers');
gr.addQuery('name',current.name);
gr.addQuery('u_switch',current.u_switch);
gr.query();
if(gr.next()) {
gs.addErrorMessage("The phone number on the selected switch is already in use");
current.setAbortAction(true);
}
})(current, previous);
I hope this gets you what you need.
/Lasse
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2017 12:00 PM
Hi Eddie,
I'll suggest two options:
a) you use an insert onBefore Business Rule where you first check if the cell phone number already exists, if not, abort the action and display a message to the user
b) make the phone number field a field with unique values.
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2017 12:05 PM
Is the phone number a reference field?
If it's not related to anything, consider making the field unique - this will prevent duplicates being added.