- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2022 10:59 PM
When I save a record (Vendor risk issue), it's taking lot of time even though internet speed is good. I'm getting a Running Transaction message on the top along with the time in seconds. Here i found the BR which effect the this Running Transaction time.
Could you please let me know what needs to be done in the BR.
After insert and update on BR on --- 'sn_vdr_risk_asmt_issue' Table
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2022 01:05 AM
I am guessing you need to add this line before first query so that you can get the corresponding company only instead of everything.
gr1.addQuery('sys_id',current.vendor);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2022 01:10 AM
Hi,
why not make the BR as Async Insert/Update?
Also check suggestion mentioned by Kalaiarasan
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2022 04:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2022 04:29 AM
Hi,
something like this
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr1 = new GlideRecord('core_company');
gr1.addQuery('sys_id', current.vendor);
gr1.query();
while(gr1.next()){
var vendorCount;
var agg = new GlideAggregate('sn_vdr_risk_asmt_issue');
agg.addAggregate('COUNT', 'vendor');
agg.addEncodedQuery('stateNOT IN3,4,7');
agg.query();
while (agg.next()) {
//do things on the results
vendorCount = agg.getAggregate('COUNT', 'vendor');
}
gr1.u_open_issue_count_1 = vendorCount;
gr1.update();
}
})(current, previous);
regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader