diff --git a/Client-Side Components/Catalog Client Script/Auto Assign incident/Readme.md b/Client-Side Components/Catalog Client Script/Auto Assign incident/Readme.md new file mode 100644 index 0000000000..aa876b708a --- /dev/null +++ b/Client-Side Components/Catalog Client Script/Auto Assign incident/Readme.md @@ -0,0 +1 @@ +This project automatically assigns incidents to different support groups based on the time of day. For example, incidents created during day shift are assigned to the Day Support Group, while those created during night shift go to the Night Support Group. This ensures timely handling and reduces manual routing. diff --git a/Client-Side Components/Catalog Client Script/Auto Assign incident/Script.JS b/Client-Side Components/Catalog Client Script/Auto Assign incident/Script.JS new file mode 100644 index 0000000000..1ce92beecc --- /dev/null +++ b/Client-Side Components/Catalog Client Script/Auto Assign incident/Script.JS @@ -0,0 +1,14 @@ +(function executeRule(current, previous /*null when async*/) { + var now = new GlideDateTime(); + + var daySchedule = new GlideSchedule('46d3f0b1dbf01300a6a5f0b1dbf01300'); // Day Schedule + var nightSchedule = new GlideSchedule('56e4f0b1dbf01300a6a5f0b1dbf01300'); // Night Schedule + + if (daySchedule.isInSchedule(now)) { + current.assignment_group = '76f5f0b1dbf01300a6a5f0b1dbf01300'; // Day Support Group + } else if (nightSchedule.isInSchedule(now)) { + current.assignment_group = '86g6f0b1dbf01300a6a5f0b1dbf01300'; // Night Support Group + } else { + current.assignment_group = 'f2c9980bf9bc3a10f9182b07f0f0832a'; // Optional fallback + } +})();