Create a story from incident

Shannon Burns
Kilo Sage

Does anyone have code they have created (and can share) for a UI action on incident that creates a story from the inc?  I know the general concept (like look at the create problem action and get a sense from there what needs to be done), but I thought if someone has it handy, I wouldn't have to reinvent the wheel.

Thanks,
Shannon

1 ACCEPTED SOLUTION

Elijah Aromola
Mega Sage

This can be edited depending on what fields you want populated. 

var newStory = new GlideRecord("rm_story");
newStory.initialize(); 
newStory.short_description = current.short_description;
newStory.description = current.description; 
newStory.state = 6; //draft
newStory.opened_by = gs.getUserID(); //Story opened by will be whoever clicked UI action
newStory.insert(); 

 

Please mark this as helpful/correct if it resolved your question!

View solution in original post

2 REPLIES 2

Elijah Aromola
Mega Sage

This can be edited depending on what fields you want populated. 

var newStory = new GlideRecord("rm_story");
newStory.initialize(); 
newStory.short_description = current.short_description;
newStory.description = current.description; 
newStory.state = 6; //draft
newStory.opened_by = gs.getUserID(); //Story opened by will be whoever clicked UI action
newStory.insert(); 

 

Please mark this as helpful/correct if it resolved your question!

Thanks a lot!

 

Shannon