How to set priority for REQ table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2024 10:59 AM
Implement a rule that when a new "Service Catalog Request" is submitted with a high priority , it checks for any open incidents from the same user in the past 30 days. If more than three such incidents are found, change the priority of the new request to "Priority 2" .
How to set REQUEST priority after submitting the form on the portal or from backend?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2024 11:26 AM
You can write a Business Rule which runs on "Before" "Insert" and do a GlideAggregate query to check if the user created more than three incidents in last 30 days, if yes then change the priority value.
You can also create a flow to do the same thing.
If this solution helps you then, mark it as accepted solution ✔️ and give thumbs up👍!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2024 11:33 AM
Hi @indrajeetma ,
You got to create a business rule to query all the incidents created by the the user in last 3 months and see if the returned records/sys_id are more than 3. if its so, then you can update the current record priority to '2'.
code may looks like this :
var requestedBy = current.requested_by;
if (requestedBy) {
// Create a GlideRecord to count incidents
var incidentGR = new GlideRecord('incident');
incidentGR.addQuery('caller_id', requestedBy);
incidentGR.addQuery('sys_created_on', '>=', GlideDateTime.addDays(new GlideDateTime(), -30));
incidentGR.query();
var incidentCount = incidentGR.getRowCount();
if (incidentCount > 3) {
current.priority = 2; // Set priority to 2
}
}
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....