- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2017 04:11 AM
Hi All,
I have a table as follows:
I don't want duplicate values as follows:
I want to put a validation that user should not be able to submit the record if there is already a record with 2500 limit.
I want to know whether it will be a best practice to put validation as if there are 10,000 records with 2500 limit value, will it be going to impact my system performance.
Regards,
Shikha Khanna
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2017 04:18 AM
Hi Shikha,
Are you saying you don't need duplicate values in the Limit column when the record is created by user?
If yes then have before insert business rule and query the same table with the value of limit field and if found use current.setAbortAction(true);
Script:
var gr = new GlideRecord('table_name');
gr.addQuery('limit',current.u_limit);
gr.query();
if(gr.next()){
gs.addInfoMessage('There is duplicate value for limit in the table');
current.setAbortAction(true);
}
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2017 04:16 AM
Hello Shikha,
Make the filed Subsidairy id field as unique.
Configure dictionary on field and make the unique field as true.
By default unique is not there add it from the sluchblucket of configure dictionary.
ServiceNow Commnunity MVP -2018 class.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2017 04:47 AM
I dn't want to make subsidiary ID unique.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2017 04:18 AM
Hi Shikha,
Are you saying you don't need duplicate values in the Limit column when the record is created by user?
If yes then have before insert business rule and query the same table with the value of limit field and if found use current.setAbortAction(true);
Script:
var gr = new GlideRecord('table_name');
gr.addQuery('limit',current.u_limit);
gr.query();
if(gr.next()){
gs.addInfoMessage('There is duplicate value for limit in the table');
current.setAbortAction(true);
}
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2017 04:52 AM