- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-20-2022 01:16 AM
Hi
I want to add the number field of a record (if it exists) into a field in another table. Is it best to run a business rule, or to specify this in the dictionary entry for the reference field? Then next questions is, how do I do this?
All help is highly appreciated š
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-20-2022 01:21 AM
Best way is to use Business Rule only if you want to achieve it when any Changes or Update happened in your record.
And if you want to achieve it for existing record, you should go with Fix Script.
So based on your requirement you can implement by GlideRecord() another table and update the field.
NOTE: For Reference field, sys_id is stored in the backend.
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-20-2022 05:00 AM - edited ā10-20-2022 05:03 AM
@Naga Ravindra R and @AnubhavRitolia To further explain, I need the field populated so I make this BR effective, but maybe you know how I can reference the related list instead of the form field to achieve this?
Current br dependant on u_request field:
(function executeRule(current, previous /*null when async*/) {
var grr = new GlideRecord('sc_request');
grr.addQuery('sys_id',current.u_request); // this is the field name where change number is getting saved in case record
grr.query();
if(grr.next())
{
gs.addInfoMessage('Comment inserted from case to req');
grr.comments= "Inserted from Request Item: " + current.comments.getJournalEntry(1);
grr.update();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-20-2022 05:20 AM
Related List will automatically track all Requests which are created through that case (i.e., where Parent of Request is that Case Number).
OOTB, 1 Case can have multiple Request so Related List is best way to track all Request. Even in case of 1 request, it is always suggested to use OOTB features only at Max.
Your BRs are making little Confusing. Can you explain in words that what is the exact requirement of your Business Rule. What you want to achieve using Business Rule?
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023