- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 04:54 PM
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 06:07 PM - edited 10-17-2023 06:08 PM
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 👍✅
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 05:54 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 06:07 PM - edited 10-17-2023 06:08 PM
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 👍✅
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2023 07:51 AM
Thank you so much. It worked!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2023 08:35 AM
@WP2 Can you please also mark the answer helpful.
Anvesh