Skip to content

Commit d91098a

Browse files
authored
Create script.js
UI action script code
1 parent cfaf055 commit d91098a

File tree

1 file changed

+32
-0
lines changed
  • Client-Side Components/UI Actions/Convert Catalog Task 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+
// Initialize new GlideRecord for rm_story table
2+
var gr = new GlideRecord("rm_story");
3+
4+
// Copy description from current record (likely a Requested Item or similar)
5+
gr.description = current.description;
6+
7+
// Set story type to 'Enhancement'
8+
gr.type = "Enhancement";
9+
10+
// Assign requested_for user as tester
11+
gr.u_tester = current.request.requested_for; //custom field-optional
12+
13+
// Link story to source record via u_created_from field
14+
gr.u_created_from = current.sys_id; //optional custom field to link request to story
15+
16+
// Insert the new story and capture its sys_id
17+
var sysID = gr.insert();
18+
19+
// Store the story sys_id in the source record for traceability
20+
current.rm_story_id = sysID;
21+
22+
// Update the source 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 the newly created story
29+
action.setRedirectURL(gr);
30+
31+
// Set return URL to the original source record
32+
action.setReturnURL(current);

0 commit comments

Comments
 (0)