- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2016 10:24 PM
HI,
How to limit a table for single record entry only ?
it should throw an error if someone try to add new record because this table already has one record.
Thanks in advance !
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2016 11:14 PM
Hi sarath,
Apply before business rule on insert and
in script section write this ///And in actions you can write the message whatever you feel....
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord("u_one_record_table");
gr.query();
var cn = gr.getRowCount();
if(cn>=1)
{
current.setAbortAction(true);
}
})(current, previous);
Regards'
Kirtesh
Pls mark as correct/helpful/like if you think so 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2016 10:51 PM
ohh, You can certainty do that, by a before business rule with setAbortAction and AddErrorMessage.
But, I would instead create a system property record than a table in case if you want to use that record as metadata or some sort.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2016 11:14 PM
Hi sarath,
Apply before business rule on insert and
in script section write this ///And in actions you can write the message whatever you feel....
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord("u_one_record_table");
gr.query();
var cn = gr.getRowCount();
if(cn>=1)
{
current.setAbortAction(true);
}
})(current, previous);
Regards'
Kirtesh
Pls mark as correct/helpful/like if you think so 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2016 11:36 PM
Thanks for the quick response