- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-20-2022 02:09 AM
Hi Experts,
I have one requirement like "When I create a update set that name should be unique. Its not be same as existing update set. if existing and newly created update set is same need to notify while saving with error popup " Update set name is already in our records so please change the name "
And Duplicate update sets should be removed or renamed if being used for active development.
I am not sure how to be proceed. Need your assistance on it. Any help will be appreciated.
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-20-2022 02:20 AM
Hi,
you can also make Name field on "sys_update_set" as Unique at dictionary level
BR Script If required
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord("sys_update_set");
gr.addQuery("name", current.getValue('name'));
gr.setLimit(1);
gr.query();
if (gr.hasNext()) {
gs.addErrorMessage("Please give unique update set name.");
current.setAbortAction(true);
}
})(current, previous);
regards
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
ā09-20-2022 02:18 AM
Hi,
you will have to create before insert business rule on "sys_update_set" table and create your own logic.
regards
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
ā09-20-2022 02:20 AM
Hi,
you can also make Name field on "sys_update_set" as Unique at dictionary level
BR Script If required
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord("sys_update_set");
gr.addQuery("name", current.getValue('name'));
gr.setLimit(1);
gr.query();
if (gr.hasNext()) {
gs.addErrorMessage("Please give unique update set name.");
current.setAbortAction(true);
}
})(current, previous);
regards
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
ā09-20-2022 02:47 AM
Hi
Awesome! Its working as expected.
Thanks for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-08-2025 01:52 PM
Hi i created the before insert and update BR using your exact script on the update set table and when creating a update set with the exact same name as another. No error message appears.
can you assist?