File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Server-Side Components/Background Scripts/Problem from Incident Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ var CreateProblemFromIncident = Class.create();
2+ CreateProblemFromIncident.prototype = {
3+ initialize: function() {
4+ },
5+
6+ createProblem: function(incidentSysId) {
7+ var incidentGR = new GlideRecord('incident');
8+ if (!incidentGR.get(incidentSysId)) {
9+ gs.error('Incident not found: ' + incidentSysId);
10+ return null;
11+ }
12+
13+ var problemGR = new GlideRecord('problem');
14+ problemGR.initialize();
15+ problemGR.short_description = 'Problem related to: ' + incidentGR.short_description;
16+ problemGR.description = 'Derived from Incident ' + incidentGR.number + ': ' + incidentGR.description;
17+ problemGR.impact = incidentGR.impact;
18+ problemGR.urgency = incidentGR.urgency;
19+ problemGR.priority = incidentGR.priority;
20+ problemGR.cmdb_ci = incidentGR.cmdb_ci;
21+ problemGR.opened_by = gs.getUserID();
22+ problemGR.insert();
23+
24+ // Link the incident to the problem
25+ incidentGR.problem_id = problemGR.sys_id;
26+ incidentGR.update();
27+
28+ return problemGR.sys_id;
29+ },
30+
31+ type: 'CreateProblemFromIncident'
32+ };
You can’t perform that action at this time.
0 commit comments