SAFe Feature - Move completed stories to new feature
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2023 02:05 PM
Hello,
I have a requirement to change the behavior of the 'Move completed stories to new feature' UI Action. Currently it changes the State to releases but we would like to move it to deploy as the stories are not necessarily released at the time of splitting the stories. Since the SAFeSplitFeatureUtil script include is read only I extended it, now the state will no longer move to released but it does move to Implementation. Maybe the script is wrong and it defaults to Implementation? I can not figure it out. Extended script is below, the only thing I changed is the NEW_FEATURE_STATE: "9", from NEW_FEATURE_STATE: "3",
Thanks
var SAFeSplitFeatureDeployUtil = Class.create();
SAFeSplitFeatureDeployUtil.prototype = Object.extendsObject(SAFeSplitFeatureUtil, {
NEW_FEATURE_STATE: "9",
FEATURE_FIELDS_TO_COPY: [
'sn_safe_epic', 'enabler', 'color', 'sn_safe_program', 'user_business_value',
'risk_reduction', 'time_criticality', 'job_size', 'description', 'wsjf_score', 'assignment_group'
],
splitFeature: function(existingFeatureGR, isModal) {
var statesUtil = new global.ScrumStatesUtil('sn_safe_story');
var storyCompletedStates = statesUtil.getCompletedStates();
var storyGR = new GlideRecord('sn_safe_story');
storyGR.addQuery('sn_safe_feature', existingFeatureGR.getUniqueValue());
storyGR.addQuery('state', 'IN', storyCompletedStates.join(','));
storyGR.query();
var newFeatureGR = this._createNewFeature(existingFeatureGR);
if (!newFeatureGR.isValidRecord())
return;
var newFeatureID = newFeatureGR.getUniqueValue();
storyGR.setValue('sn_safe_feature', newFeatureID);
storyGR.updateMultiple();
this._setInfoMessage(newFeatureGR, existingFeatureGR, isModal);
this._setGlobalRank(existingFeatureGR.getUniqueValue(), newFeatureID);
return newFeatureGR;
},
_createNewFeature: function(existingFeatureGR) {
var newFeatureGR = new GlideRecord('sn_safe_feature');
newFeatureGR.initialize();
newFeatureGR.setValue('short_description', existingFeatureGR.getValue('short_description') + ' - Completed');
this.FEATURE_FIELDS_TO_COPY.forEach(function(item) {
newFeatureGR.setValue(item, existingFeatureGR[item]);
});
newFeatureGR.setValue('state', this.NEW_FEATURE_STATE);
newFeatureGR.setValue('original_feature', existingFeatureGR.getUniqueValue());
newFeatureGR.setValue('sn_safe_program_increment', existingFeatureGR.getValue('sn_safe_program_increment'));
var newFeatureID = newFeatureGR.insert();
if (newFeatureID)
GlideSysAttachment.copy('sn_safe_feature', existingFeatureGR.getUniqueValue(), 'sn_safe_feature', newFeatureID);
return newFeatureGR;
},
_setInfoMessage: function(newFeatureGR, existingFeatureGR, isModal) {
var link;
if (isModal) {
var returnUrl = existingFeatureGR.getLink() + '&sysparm_view=safe';
link = 'sn_safe_feature.do?sys_id=' + newFeatureGR.getUniqueValue() + '&sysparm_stack=' + returnUrl;
} else
link = newFeatureGR.getLink();
var tag = '<a href="' + link + '">' + newFeatureGR.getValue('number') + '</a>';
var recordLink = GlideSecurityUtils.escapeScript(tag);
gs.addInfoMessage(gs.getMessage('Feature {0} has been created successfully', recordLink));
},
_setGlobalRank: function(existingFeatureID, newFeatureID) {
var safeRankProcessor = new SAFeRankProcessor('sn_safe_feature', 'global_rank');
safeRankProcessor.moveBefore(newFeatureID, existingFeatureID);
},
type: "SAFeSplitFeatureDeployUtil"
});
- Labels:
-
Agile Development