The CreatorCon Call for Content is officially open! Get started here.

Restricting user to create only 1 record on a table

Parker1
Kilo Contributor

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.

1 ACCEPTED SOLUTION

Narendra Kota
Mega Sage

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.

View solution in original post

1 REPLY 1

Narendra Kota
Mega Sage

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.