Skip to content

Commit 4b30e36

Browse files
authored
Create code.js
UI action script
1 parent 450361e commit 4b30e36

File tree

1 file changed

+32
-0
lines changed
  • Client-Side Components/UI Actions/Convert Incident to a story

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Get caller ID from the incident record
2+
var callerID = current.caller.id;
3+
4+
// Initialize new story record
5+
var gr = new GlideRecord("rm_story");
6+
gr.short_description = current.short_description; // Copy short description
7+
gr.description = current.description; // Copy full description
8+
gr.type = "Fix"; // Set story type to 'Fix'
9+
10+
// Assign caller as both requirements owner and tester
11+
gr.u_tester = current.caller_id;
12+
13+
// Link story to originating incident
14+
gr.u_created_from = current.sys_id; //cutom field to populate incident record or request -not required
15+
16+
// Insert story and capture its sys_id
17+
var sysID = gr.insert();
18+
19+
// Store story sys_id on incident for traceability
20+
current.rm_story_id = sysID;
21+
22+
// Update incident record
23+
var mySysID = current.update();
24+
25+
// Display confirmation message with story number
26+
gs.addInfoMessage("Agile Story " + gr.number + " created");
27+
28+
// Redirect user to newly created story
29+
action.setRedirectURL(gr);
30+
31+
// Set return URL to original incident
32+
action.setReturnURL(current);

0 commit comments

Comments
 (0)