Feature field change and new Feature select the Impact of the story should be same new Feature field

Arjun Reddy Yer
Mega Sage

required help @Vasantharajan N @Ankur Bawiskar @Voona Rohila @WillieW @RaghavSh

 

When Feature field change on the story and new Feature selected in the available list and then the Impact of the story is to be fill based on the new selected Feature. 

Story Impact should be based on Feature field.

I tried with Business Rule but it's not working as expected.

ArjunReddyYer_0-1766142836974.png

Business Rule:

 

ArjunReddyYer_1-1766143023165.png

ArjunReddyYer_2-1766143092084.png

			var fst = new GlideRecord('sn_safe_feature');
		fst.addQuery('sn_safe_story',current.sys_id);
		fst.query();

		while(fst.next()){
			fst.impact = current.impact;
			fst.priority = current.priority;
			fst.update();
			
		}
1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Arjun Reddy Yer 

your business rule should be before Insert & Update

Condition: Feature [Changes] AND Feature [IS NOT EMPTY]

Script:

// use correct field which refers to feature table below

current.impact = current.sn_safe_feature.impact;
current.priority = current.sn_safe_feature.priority;

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

8 REPLIES 8

TejasSN_LogicX
Tera Contributor

Hi @Arjun Reddy Yer ,

Your logic is reversed. You are updating Feature from Story, but the requirement is to update Story Impact based on selected Feature.

 

When Feature field changes on Story, copy values from Feature → to Story.

 

Business Rule setup

  • Table: Story (sn_safe_story)

  • When: before

  • Insert: true

  • Update: true

  • Condition: Feature changes

 

if (!current.feature)
return;

var featureGR = new GlideRecord('sn_safe_feature');
if (featureGR.get(current.feature)) {

// Copy from Feature to Story
current.impact = featureGR.impact;
current.priority = featureGR.priority;
}

 

 

 

or you can write the on change client script . when the feature field value changes it will populate the other field values  .      let me know if you need on change client script and script include logic ...


Ankur Bawiskar
Tera Patron
Tera Patron

@Arjun Reddy Yer 

your business rule should be before Insert & Update

Condition: Feature [Changes] AND Feature [IS NOT EMPTY]

Script:

// use correct field which refers to feature table below

current.impact = current.sn_safe_feature.impact;
current.priority = current.sn_safe_feature.priority;

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Tried with below script but on the form when I try to change Safe Team is getting empty so unable to change.

But I try it in List view to change the Feature field value but the Impact of the Story is not getting change.

var featureGR = new GlideRecord('sn_safe_feature');
if (featureGR.get(current.feature)) {

// Copy from Feature to Story
current.impact = current.sn_safe_feature.impact;
current.priority = current.sn_safe_feature.priority;
}

ArjunReddyYer_0-1766145581801.png

 

 

@Arjun Reddy Yer 

why are you again querying the feature table?

you already have a reference field pointing to that?

simply dot walk and set the values similar to what I shared

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader