- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2019 01:08 PM
I am trying to restrict user form creating multiple record entries on a table. How would I accomplish this with a business rule or client script? So if the user clicks new to start a new record when they try to submit they just get a alert and are unable to submit.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2019 06:54 PM
Try this,
write Before Insert Business rule on the table where you want to restrict.
(function executeRule(current, previous /*null when async*/) {
var duplicate = new GlideRecord('incident');//Replace this table name accordingly
duplicate.addQuery('sys_created_by', gs.getUserName());
duplicate.query();
if(duplicate.next()){
gs.addInfoMessage('Test');
current.setAbortAction(true);
}
})(current, previous);
Mark my answer as correct or helpful if it helped.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2019 06:54 PM
Try this,
write Before Insert Business rule on the table where you want to restrict.
(function executeRule(current, previous /*null when async*/) {
var duplicate = new GlideRecord('incident');//Replace this table name accordingly
duplicate.addQuery('sys_created_by', gs.getUserName());
duplicate.query();
if(duplicate.next()){
gs.addInfoMessage('Test');
current.setAbortAction(true);
}
})(current, previous);
Mark my answer as correct or helpful if it helped.