- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2023 08:16 AM
Scheduled reports to send to assignment group managers when the tickets are unassigned or assigned to field is empty, how can we achieve it, please help me.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2023 12:00 PM
@bhanu27 you can include this report too, follow all the steps as is except Step 3: Mail Script.
Copy the sys_id of your report then in Step 4: Notification replace
${mail_script:ag_unassigned_incident_report}
With
${report:reportID:YOUR_REPORT_SYSID}
This will include your report as PDF attachment in the notification email.
Please mark my answer helpful and accept as solution if it helped you 👍✅
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 08:51 PM
@bhanu27 Who is the run as user for Scheduled Job? And check the user which you are using to test (i.e. changing the assignment group) have access to table , are there any ACL restrictions (report type ACL also).
And try creating a new simple report and try to insert that in the code and check, whether you are getting the same error or not?
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2023 07:55 PM - edited 10-26-2023 10:33 PM
Hi @AnveshKumar M ,
Thanks for reply.
The first requirement is
I want this mail to be triggered immediately on unassigned count reaching 5 or more.
Second thing every Monday I need to send report irrelevant of ticket count..
So can you please share me script Accordingly the first requirement is my priority.
Thanks in advance.
Regards
Bhanu.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2023 06:33 AM
Try the following approach.
1. Create an Event in event registry
2. Create a business rule
(function executeRule(current, previous /*null when async*/) {
var incGr = new GlideRecord("incident");
incGr.addQuery("assignment_group", current.assignment_group);
incGr.addEncodedQuery("assigned_toISEMPTY");
incGr.setLimit(11);
incGr.query();
if(incGr.getRowCount() >= 5){
gs.eventQueue("incident.unassigned.count5", current, current.assignment_group);
}
})(current, previous);
3. Mail Script:
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var incGr = new GlideRecord("incident");
incGr.addQuery("assignment_group", current.assignment_group);
incGr.addEncodedQuery("assigned_toISEMPTY");
incGr.query();
var incidents = '<table style="width: 100%;"><tbody><tr><td class="bg1" colspan="7">Number</td><td class="bg1" colspan="7">Short Description</td></tr>';
while (incGr._next()) {
incidents = incidents + '<tr><td colspan="7">' + incGr.number + '</td><td colspan="7">' + incGr.short_description + '</td></tr>';
}
incidents = incidents + '</tbody></table>';
template.print(incidents);
})(current, template, email, email_action, event);
4. Notification:
<p> </p>
<style><!--
table {
font-family: cambria;
}
td.bg1{
background-color:#E2E2E3;
color:#7C427F;
font-weight: bold;
}
td.bg2{
color:black;
}
img.bottom {
vertical-align: text-bottom;
}
--></style>
<table style="width: 100%;">
<tbody>
<tr>
<td colspan="7">Dear ${assignment_group.manager},<br />
<p>${assignment_group} has more than 5 unassigned Incidents</p>
</td>
</tr>
</tbody>
</table>
<h4>Un Assigned Incidents:</h4>
<p>${mail_script:ag_unassigned_incident_report}</p>
5. Scheduled Job:
var grpGr = new GlideRecord("sys_user_group");
grpGr.query("active", true);
grpGr.query();
while (grpGr.next()) {
var incGr = new GlideRecord("incident");
incGr.addQuery("assignment_group", grpGr.sys_id);
incGr.addEncodedQuery("assigned_toISEMPTY");
incGr.setLimit(6);
incGr.query();
if (incGr.getRowCount() >= 5) {
incGr.next();
gs.eventQueue("incident.unassigned.count5", incGr, incGr.assignment_group);
}
}
Final Result:
Please mark my answer helpful and accept as solution if it helped you 👍✔️
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2023 07:10 AM
Really a very big thanks for your response and patience and time spent for me this is really a great thing.
But my concern is i need to send a schedule report like below to assignment group managers when the assigned to field is empty and assignment group is not empty.
In below screen there are some unassigned tickets for each group so i need to send this report to those respective managers with attachment
can you please help me on it like writing a script/condition in schedule report
Thanks and Regards
Bhanu.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2023 12:00 PM
@bhanu27 you can include this report too, follow all the steps as is except Step 3: Mail Script.
Copy the sys_id of your report then in Step 4: Notification replace
${mail_script:ag_unassigned_incident_report}
With
${report:reportID:YOUR_REPORT_SYSID}
This will include your report as PDF attachment in the notification email.
Please mark my answer helpful and accept as solution if it helped you 👍✅
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2023 07:43 AM
Thanks for the your reply and solution, really it is helpful and almost my job is done, the only small thing that is not working is, am getting null report as attachment instead of my report, and when i open my report it showing below message.
My Notification screen is as below: