automated email to inform leavers about their computers to return before leaving the company
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2024 05:44 AM
we wish to add an automated email to inform leavers about their computers to return before leaving the company. This to avoid the surprise and the confusion of many users who discover that they need to take back some computers they do not use anymore when they are coming to the onsite support at their last day of work.
(function runMailScript(current, template, email, email_action, event) {
var user = event.parm1;
var arr = [];
var gr = new GlideRecord('cmdb_ci'); // table name changed
gr.addQuery('assigned_to', user);
gr.query();
while(gr.next()){
var str = gr.asset_tag + ' - ' + gr.name + ' - ' + gr.model_id.getDisplayValue();
arr.push(str.toString());
}
template.print('<ul>');
for(var i=0;i<arr.length;i++){
template.print('<li>' + arr[i] + '</li>')
}
template.print('<ul>');
})(current, template, email, email_action, event);
Notification body:
present script is working fine but for example user have two assets then we need to display second asset details into asset 2 line but present all assets details displaying in asset 1 line so please help me how to get asset 2 line with asset 2 detalis

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2024 08:13 AM
Get ride of the right and left parenthesis in your mail script name.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2024 10:57 PM
may i know how to do that