stories
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2023 10:28 PM
As a platform owner, I want to be to able to create story from an enhancement record AND
when
story is created,
if story state -> draft, enhancement state -> scoping
story state -> ready, enhancement state - > work in progress
story state -> cancelled, enhancement state - > cancelled
story state -> complete, enhancement state - > complete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2023 12:53 AM
Hello @pragadeesh254,
There must be a field called 'Original Task' or 'Parent'. So you can use that field's backend value in the script that I have provided in my previous reply to complete your requirement.
If above answer resolve your issue, Please mark the solution as 'Accepted Solution' and Also mark it as 'Helpful'.
Thank You!
Prathamesh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2023 11:22 PM
If you want a no code approach, you can create a flow like the one below.
1. Flow properties.
2. Trigger conditions
3. Create Flow Logic and Corresponding Update Actions
The final completed flow would be like this,
Please mark my answer helpful and accept as a solution if it helped 👍✔️
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2023 11:32 PM
@pragadeesh254 You can create an After - Insert/Update BR like the one below.
Note: Sate is one of Draft, Ready, Completed, Cancelled
(function executeRule(current, previous /*null when async*/) {
var enhancement = current.getValue("enhancement") + '';
var enGr = new GlideRecord("rm_enhancement");
if(enGr.get("sys_id", enhancement)){
if(current.state == '-6'){
enGr.setValue("state", "-4");
} else if(current.state == '1'){
enGr.setValue("state", "2");
} else if(current.state == '3'){
enGr.setValue("state", "3");
} else if(current.state == '4'){
enGr.setValue("state", "7");
}
enGr.update();
}
})(current, previous);
Please mark my answer helpful and accept as a solution if it helped 👍 ✔️
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2023 11:57 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2023 12:50 AM
Hello @pragadeesh254,
You can create an UI action on the Enhancement table to create the story. Below is the attached code where you can create the UI action for Creating a story from the enhancement record.
UI Action -
createStory();
function createStory() {
// (1) Copy Enhancement fields into a new story
var story = new GlideRecord("rm_story");
story.priority = current.priority;
story.short_description = current.short_description;
story.assignment_group = current.assignment_group;
story.assigned_to = current.assigned_to;
story.description = current.description;
story.work_notes = current.work_notes;
story.type="Development";
story.opened = current.opened;
story.opened_by = current.opened_by;
story.product = null;
story.state = getNewState(current);
story.insert();
// (2) Redirect webpage to the new story (Ensure story displayed in scrum view)
gs.addInfoMessage(gs.getMessage("Story {0} created", story.number));
action.setRedirectURL(story);
var redirectURL = action.getRedirectURL();
redirectURL = redirectURL.replace("sysparm_view=", "sysparm_view=scrum");
action.setRedirectURL(redirectURL);
action.setReturnURL(current);
}
And you can create a After > Update Business Rule on the Story [rm_story] table with the Condition as 'State Changes'.
And in the Advanced section, you can add the below code to set the its related enhancement record's state.
(function executeRule(current, previous /*null when async*/ ) {
if (current.state == 'draft') { //always take the backend value for the choices
current.enhancement.state = 'scoping'; //use the dot-walk functionality to update the related enhancement record of the story.
} else if (current.state == 'ready') {
current.enhancement.state = 'work in progress';
} else if (current.state == 'cancelled') {
current.enhancement.state = 'cancelled';
} else if (current.state == 'complete') {
current.enhancement.state = 'complete';
}
})(current, previous);
If above answer resolve your issue, Please mark the solution as 'Accepted Solution' and Also mark it as 'Helpful'.
Thank You!
Prathamesh.