when I change the priority of my xyz table record to 1 then all other records which has a
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2023 12:44 AM - edited 12-22-2023 01:03 AM
when I change the priority of my xyz table record to 1 then all other records which has a priority 1 should change automatically to none.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2023 01:22 AM
why are you asking the same question again and also without providing more details?
You marked your previous question as "Correct". So was the answer there helpful or not? See https://www.servicenow.com/community/itsm-forum/when-i-change-the-priority-of-my-incident-record-to-...
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2023 01:27 AM - edited 12-22-2023 01:32 AM
Hello @Abhishek Kathe
If its a Incident table then it will be depending on urgency and impact but if its different table lets say custom one and in there as well if the priority is depending on urgency and impact then you can do it there as well but you need to see the dependencies first.
Please refer the script below and make the changes as per your requirement.
After Update Business Rule:
(function executeRule(current, previous) {
// Check if priority is changed to 1
if (current.priority == 1 && current.priority != previous.priority) {
// Update other records with priority 1 to 'none'
var gr = new GlideRecord('xyz_table');
gr.addQuery('priority', 1);
gr.addQuery('sys_id', '!=', current.sys_id); // Exclude the current record
gr.query();
while (gr.next()) {
gr.priority = 'none';
gr.update();
}
}
})(current, previous);
Let me know your views on this and Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks,
Aniket

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2023 01:42 AM
@Abhishek Kathe You need to write a business onBefore Update business rule as follows.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2023 01:50 AM
sorry, but this makes no sense and is also pretty dangerous! As experts, we have a certain responsibility and cannot recommend just any nonsense. Do you have an idea what happens if such a script is fired in a production instance with let's say several tens of thousands of tickets? Think about this carefully and hopefully you do not implement something like this for your customers!
Maik