code transfer
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2025 03:10 AM
<table style="width: 100%; border-collapse: collapse; font-family: Arial, sans-serif; border: 1px solid rgb(136, 136, 140);">
<tbody>
<!-- Table Title -->
<tr>
<td colspan="2" style="background-color: rgb(126, 128, 126); color: white; font-size: 1.5em; font-weight: bold; padding: 8px; border: 1px solid rgb(136, 136, 140);">
<span style="font-family: Aptos, sans-serif; font-size: 15.0pt;">Critical Incident Communication</span>
</td>
</tr>
<!-- Priority Banner -->
<tr>
<td colspan="2" style="background-color: ${mail_script:im_cic_priority_color}; color: ${mail_script:im_cic_priority_textcolor}; font-weight: bold; padding: 4px; border: 1px solid #88888c; border-top: none;">
<span style="font-family: Aptos, sans-serif; font-size: 12.0pt;">Priority ${mail_script:im_cic_priority}</span>
</td>
</tr>
<!-- Incident hyperlink (WHITE row, no shading) -->
<tr>
<td colspan="2" style="border: 1px solid rgb(136, 136, 140); padding: 4px;">
<span style="font-family: Aptos, sans-serif; font-size: 12.0pt;">${URI_REF}</span>
</td>
</tr>
<!-- Priority (gray row) -->
<tr style="background-color: rgb(201, 201, 201);">
<td colspan="2" style="border: 1px solid rgb(136, 136, 140);">
<span style="font-family: Aptos, sans-serif; font-size: 12.0pt;">
<span style="font-weight: bold;">Priority:</span> ${priority}
</span>
</td>
</tr>
<!-- Start (white row) -->
<tr>
<td colspan="2" style="border: 1px solid rgb(136, 136, 140);">
<span style="font-family: Aptos, sans-serif; font-size: 12.0pt;">
<span style="font-weight: bold;">Start:</span> ${u_outage_start}
</span>
</td>
</tr>
<!-- Resolved (gray row) -->
<tr style="background-color: rgb(201, 201, 201);">
<td colspan="2" style="border: 1px solid rgb(136, 136, 140);">
<span style="font-family: Aptos, sans-serif; font-size: 12.0pt;">
<span style="font-weight: bold;">Resolved:</span> ${u_outage_end}
</span>
</td>
</tr>
<!-- Duration (white row) -->
<tr>
<td colspan="2" style="border: 1px solid rgb(136, 136, 140);">
<span style="font-family: Aptos, sans-serif; font-size: 12.0pt;">
<span style="font-weight: bold;">Duration:</span> ${mail_script:im_cic_duration}
</span>
</td>
</tr>
<!-- Systems Impacted (gray row) -->
<tr style="background-color: rgb(201, 201, 201);">
<td colspan="2" style="border: 1px solid rgb(136, 136, 140);">
<span style="font-family: Aptos, sans-serif; font-size: 12.0pt;">
<span style="font-weight: bold;">Systems Impacted:</span> ${mail_script:im_cic_getAffectedProducts}
</span>
</td>
</tr>
<!-- Description (white row) -->
<tr>
<td colspan="2" style="border: 1px solid rgb(136, 136, 140);">
<span style="font-family: Aptos, sans-serif; font-size: 12.0pt;">
<span style="font-weight: bold;">Description:</span> ${u_cic_description}
</span>
</td>
</tr>
<!-- Impact to Clients (gray, full width) -->
<tr style="background-color: rgb(201, 201, 201);">
<td colspan="2" style="border: 1px solid rgb(136, 136, 140);">
<span style="font-family: Aptos, sans-serif; font-size: 12.0pt;">
<span style="font-weight: bold;">Impact to our Clients:</span> ${u_external_impact}
</span>
</td>
</tr>
<!-- Impact to Employees (white, full width) -->
<tr>
<td colspan="2" style="border: 1px solid rgb(136, 136, 140);">
<span style="font-family: Aptos, sans-serif; font-size: 12.0pt;">
<span style="font-weight: bold;">Impact to our Employees:</span> ${u_internal_impact}
</span>
</td>
</tr>
<!-- Cause (gray, full width) -->
<tr style="background-color: rgb(201, 201, 201);">
<td colspan="2" style="border: 1px solid rgb(136, 136, 140);">
<span style="font-family: Aptos, sans-serif; font-size: 12.0pt;">
<span style="font-weight: bold;">Cause:</span> ${u_probable_cause}
</span>
</td>
</tr>
<!-- Completed Actions (white, full width) -->
<tr>
<td colspan="2" style="border: 1px solid rgb(136, 136, 140);">
<span style="font-family: Aptos, sans-serif; font-size: 12.0pt;">
<span style="font-weight: bold;">Completed Actions<br></span> ${u_previous_activities}
</span>
</td>
</tr>
</tbody>
</table>
15 REPLIES 15
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
// Add your code here
template.print('<p><span style="font-family: Aptos, sans-serif; font-size: 12.0pt;"><strong>' +
gs.getMessage('Incident Manager: ') + '</strong>' + '<span style="font-weight:normal;">${u_recovery_manager.name}</span></span></p>');
if (!current.u_communication_specialist.nil()) {
template.print('<p><span style="font-family: Aptos, sans-serif; font-size: 12.0pt;"><strong>' +
gs.getMessage('Communication Specialist: ') + '</strong>' + '<span style="font-weight:normal;">${u_communication_specialist.name}</span></span></p>');
}
if (current.u_technology_owner != "") {
template.print('<p><span style="font-family: Aptos, sans-serif; font-size: 12.0pt;"><strong>' +
gs.getMessage('Technology Owner: ') + '</strong>' + '<span style="font-weight:normal;">${u_technology_owner}</span></span></p>');
}
})(current, template, email, email_action, event);
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
//Java class loading
var httpCall = Packages.com.snc.sw.commands.HttpCallHandler;
var URI = Packages.java.net.URI;
var uriException = Packages.java.net.URISyntaxException;
var httpClient = new httpCall();
//Context loding
var ciType = CTX.getAttribute('pattern_cit_id');
var url = CTX.getAttribute('url');
var namespace = CTX.getAttribute('namespace');
var credsAlias = CTX.getAttribute('credentialsAlias');
var namespaces = new Packages.java.util.ArrayList();
var row = Packages.java.util.LinkedHashMap;
var URL = null;
try{
URL = new URI(url);
}catch(err){
ms.log("Not a valid URL. E.g. https://host:port. Current is " + url);
throw new uriException(err.getMessage(), "Not a valid URL. E.g. https://host:port. Input URL is: " + url);
}
var host = URL.getHost();
var protocol = URL.getScheme();
var port = URL.getPort();
if (!port || port < 0) {
if (protocol == 'https')
port = 443;
else
port = 80;
}
var path = URL.getRawPath() + '';
if (path.endsWith('/'))
path = path.substring(0, path.length - 1);
var portString = port + '';
CTX.setAttribute('host', host);
CTX.setAttribute('port', portString);
//old url
//url = protocol + '://' + host + ':' + port + path + '/api/v1/';
//API_Prefix for non workload components of kubernetes like namespace,pods,nodes etc.
var api_prefix = '/api/v1/';
//API_Prefix for kubernetes workload components like deployments,daemonset and statefulset
if($resource.includes('deployments') ||$resource.includes('daemonsets')||$resource.includes('statefulsets'))
api_prefix = '/apis/apps/v1/';
url = protocol + '://' + host + ':' + port + api_prefix;
ms.log('original url: ' + url + ' parsed host: ' + host + ' parsed port: ' + port);
var urlCust;
var resource = $resource;
var response;
var cont;
var nextToken; // Support Pagination
var ArrayList = Packages.java.util.ArrayList; // Support Pagination
var result = new ArrayList(); // Support Pagination
//Mid Script Include KubernetesCommandMetadata initializing
var scriptInit = new KubernetesCommandMetadata();
var contentType = "accept:application/json";
var creds = scriptInit.getCredentials(host, null, credsAlias,contentType);
var headers = creds + '';
if (resource && !resource.equals('Info')) {
urlCust = url + $resource + "?limit=50";
response = httpClient.invoke(CTX, urlCust, 'GET', null, null, ciType, headers, 'false');
cont = response.match(/continue\"\:\"([^"]*)/);
if (cont)
{nextToken = cont[0].split('"')[2];}
result.add(response);
while ( JSUtil.notNil(nextToken) )
{
urlCust = url + $resource + "?limit=100&continue=" + nextToken;
response = httpClient.invoke(CTX, urlCust, 'GET', null, null, ciType, headers, 'false');
cont = response.match(/continue\"\:\"([^"]*)/);
if (cont)
{nextToken = cont[0].split('"')[2];}
else
{nextToken = "";}
result.add(response);
}
} else {
ms.log('HTTP CALL FAILED: ' + url);
}
CTX.setAttribute('response', result);
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
//
// Close any tasks that are related to the current task
//
function closeRelatedTasks(me) {
var task = new GlideRecord("task");
task.addQuery("parent", "=", me.sys_id);
task.addQuery("sys_class_name", "!=", "kb_submission");
task.query();
while (task.next()) {
if (task.sys_class_name == 'incident')
closeIncident(task.sys_id, me.number);
else if (task.sys_class_name == 'problem')
closeProblem(task.sys_id, me.number);
else if (task.sys_class_name == 'change_request')
closeChange(task.sys_id, me.number);
else {
task.active.setValue(false);
task.update();
gs.print("Task " + task.number + ' closed based on closure of task '+me.number);
}
}
}
function closeProblem(myID, fromNumber) {
var problem = new GlideRecord('problem');
if (problem.get('sys_id', myID)) {
var msg = "Problem " + problem.number + ' closed based on closure of task '+ fromNumber;
problem.state.setValue(7);
var notes = problem.close_notes.getDisplayValue();
notes = notes + '\n' + msg;
problem.close_notes.setValue(notes);
problem.update();
gs.print(msg);
}
}
function closeIncident(myID, fromNumber) {
var incident = new GlideRecord('incident');
if (incident.get('sys_id', myID)) {
var msg = "Incident " + incident.number + ' closed based on closure of task '+ fromNumber;
gs.print(msg);
incident.state.setValue(7);
incident.active.setValue(false);
incident.comments = msg;
incident.update();
}
}
function closeChange(myID, fromNumber) {
var rfc = new GlideRecord('change_request');
if (rfc.get('sys_id', myID)) {
var msg = "Change " + rfc.number + ' closed based on closure of task '+ fromNumber;
var notes = rfc.close_notes.getDisplayValue();
notes = notes + '\n' + msg;
rfc.close_notes = notes;
rfc.active = false;
rfc.update();
gs.print(msg);
}
}
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
// Collect each line into an array
var lines = [];
lines.push(
'<strong>' + gs.getMessage('Incident Manager: ') + '</strong>' +
'<span style="font-weight:normal;">' + current.u_recovery_manager.name + '</span>'
);
if (!current.u_communication_specialist.nil()) {
lines.push(
'<strong>' + gs.getMessage('Communication Specialist: ') + '</strong>' +
'<span style="font-weight:normal;">' + current.u_communication_specialist.name + '</span>'
);
}
if (current.u_technology_owner != "") {
lines.push(
'<strong>' + gs.getMessage('Technology Owner: ') + '</strong>' +
'<span style="font-weight:normal;">' + current.u_technology_owner + '</span>'
);
}
template.print(
'<p><span style="font-family: Aptos, sans-serif; font-size: 12.0pt;">' +
lines.join('<br>') +
'</span></p>'
);
})(current, template, email, email_action, event);
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
{{#if u_outage_end}}
<!-- show Resolved and Duration rows -->
{{/if}}