Populate value to a new field using BR in existing records
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2022 01:23 PM
Hi Good day!
I would just like to ask how to use business rules in populating a value to a new field?
I already added a new dictionary entry/column in the xxx table.
and created a BR with the ff script.
current.xxx_column = current.assignment_group.getDisplayValue(),' to ', current.assigned_to.getDisplayValue();
This is just basically concatenating values from reference fields. I need to have the values even there is no update/newly inserted record in the xxx table.
Please advice. Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2022 01:41 PM
Your syntax should be updated
current.xxx_column = current.assignment_group.getDisplayValue() + " - " + current.assigned_to.getDisplayValue();
As far as updating all existing records, you'll need to create a fix script or flow to update the new field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2022 01:44 PM
Example of a fix script would be
var inc = new GlideRecord('incident');
inc.addEncodedQuery('xxx_columnISEMPTY');//update xxx_column with your field name
inc.query();
while(inc.next()){
inc.xxx_column = inc.assignment_group.getDisplayValue() + " - " + inc.assigned_to.getDisplayValue();//update xxx_column with your field name
inc.update();
}
Obviously test in sub-prod first!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2022 04:11 AM
Thanks for this! it is actually worked but the action in BR is not what I am trying to work on, I just wanted to update the column thru backend, and no actions are needed from the user in order to populate the value because it causes lags/delay in the instance just to fill the column since there are a lot of incident already in our instance.