Records not getting updated in List View
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2023 11:34 AM
Currently , I have worked on a development where if service owner or service owner group has been changed on mapped application service table, It needs to be automatically updated in all the related incidents.
Issue is like only few records were seen getting updated on table list view not all.
Thanks. Below is the code for the BR I have used
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2023 12:21 PM
can you check the incidents where Service Owner and Service Owner Group not updated have same cmdb_ci / sys_id of record, from where this business rule is getting triggered?
I would suggest run following in background script to know how many incidents have application service as cmdb_ci:
var applicationID = '<add sys_id of application service>'; // add sys_id of application service here
var gr = new GlideRecord('incident');
gr.addQuery('cmdb_ci',applicationID);
gr.query();
while(gr.next()){
gs.print('Incident '+gr.number);
}
By this way you will get which are the incidents have the application service under configuration item of incident and then proceed further.
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 12:53 PM
I have run in background script to verify using getRowCount and it is matching the exact number of records which I will get from list of records after applying filter condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 01:02 PM - edited 07-19-2023 01:04 PM
that means query is correct.
Try following script in business rule and check again
var grUpdate = new GlideRecord('incident');
grUpdate.addQuery('cmdb_ci', current.sys_id);
grUpdate.query();
while (grUpdate.next()) {
grUpdate.u_service_owner = current.managed_by;
grUpdate.u_service_owner_group = current.u_service_owner_group;
grUpdate.setWorkflow(false); // I have just added this to make sure there are no aftereffects like running incident update actions
grUpdate.update();
}
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2023 12:50 PM
@sushantmalsure As we are using setWorkflow(false) here, business rule which updates the journal fields is not getting triggered because of which it is effecting audit of the incident table. We are not able to see update in activity and not able to see anything in history of the record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2023 12:58 PM
Basically when you use setWorkflow(false) it works then there must be some more BR which are running before this update which is stopping the execution.
I suggest turn on the business rule debugger and then run the script, to follow execution of all BR and check where exactly its stopping the update.
Our hands are tied here because we can not see the complete BR configurations on your instance, as the script shared for update looks good.
Regards,Sushant Malsure