Cascade Field Value from Story to Enhancement Form

WP2
Kilo Guru

Hello All,

 

I added two fields “blocked” and “blocked_reason” to the enhancement form. The requirement is to auto populate (cascade) the fields on the enhancement form with the value from the Story form (e.g if blocked = true on story then the enhancement should also be set to true and if blocked reason has information on Story, then the blocked reason on enhancement should auto populate with the same information.

My guess is that I can use a Business Rule to cascade the data from Story to auto populate on the Enhancement form. Need help with the script to achieve this requirement.

 

Thanks in advance for your help.

1 ACCEPTED SOLUTION

AnveshKumar M
Tera Sage
Tera Sage

Hi @WP2 

You can try an after update business rule on rm_story table.

 

When to run: After - Update

Conditions:

Blocked :: IS :: true

 

Script:

 

(function executeRule (current, previous){

var gr = new GlideRecord("rm_enhancement");

if(gr.get(current.enhancement.sys_id)){

//check field names of blocked & blocked reason in your enhancement table, if it is different please change accordingly

 

gr.u_blocked = current.blocked;

gr.u_blocked_reason = current.blocked_reason;

gr.update();

}

})(current, previous);

 

 

Please mark my answer helpful and accept as solution if it helped you 👍

Thanks,
Anvesh

View solution in original post

4 REPLIES 4

DanielCordick
Mega Patron
Mega Patron

You can actually create a flow that does the same thing.

 

in your flow you can set the trigger do your look ups, update fields etc,

 

this would carry less overhead that scripting as well 

AnveshKumar M
Tera Sage
Tera Sage

Hi @WP2 

You can try an after update business rule on rm_story table.

 

When to run: After - Update

Conditions:

Blocked :: IS :: true

 

Script:

 

(function executeRule (current, previous){

var gr = new GlideRecord("rm_enhancement");

if(gr.get(current.enhancement.sys_id)){

//check field names of blocked & blocked reason in your enhancement table, if it is different please change accordingly

 

gr.u_blocked = current.blocked;

gr.u_blocked_reason = current.blocked_reason;

gr.update();

}

})(current, previous);

 

 

Please mark my answer helpful and accept as solution if it helped you 👍

Thanks,
Anvesh

Thank you so much. It worked!

@WP2 Can you please also mark the answer helpful.

Thanks,
Anvesh