Update a field under reference field using BR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2025 06:55 PM
Hi All,
We have a requirement wherein, whenever there is a new record or a record is updated in this table 'Resource Allocation Daily', a field from the reference 'User' field will be updated using BR, but seems our BR is not working or maybe we are missing something?
For example:
This record RA0001 has a reference field called "User" and in that user value has an "Adoption" field. So whenever RA0001 is updated the User.Adoption will have a value of 100.
Same goes to when a new Resource Allocation Daily record is created / inserted.
Note that if RA0001 is updated, and the user in the record is User123, then the User123.Adoption value should be 100.
Thanks in advance for all your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2025 07:26 PM
Hi @ss123
Share the picture of your existing configuration.
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2025 07:36 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2025 08:01 PM
@ss123 I don't think you can dircetly set the ref field's field value like this.
Use the advanced option and scripts to fulfill your requirement. Try the below script.
(function executeRule(current, previous /*null when async*/ ) {
var alloc_user = current.getValue('<User field name from Resource allocation daily table');
var user = new GlideRecord('sys_user');
user.get(alloc_user);
user. < adoption field name >= "100";
user.update();
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2025 10:26 PM
you can have after update BR on "Resource Allocation Daily" table
Condition: Keep your existing condition
Script: Something like this but please enhance
(function executeRule(current, previous /*null when async*/) {
// Get the User record referenced in the current record
var userGR = new GlideRecord('sys_user');
if (userGR.get(current.userField)) {
// Update the Adoption field to 100
userGR.adoptionField = 100;
userGR.update();
}
})(current, previous);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader