Giving more Running Transaction time while save a record

subbarayudu
Tera Contributor

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

find_real_file.pngfind_real_file.pngfind_real_file.png

1 ACCEPTED SOLUTION

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); 

View solution in original post

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

why not make the BR as Async Insert/Update?

Also check suggestion mentioned by Kalaiarasan

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

using getRowCount in server side script is a health scan finding under performance risk category. This likely also needs to be addressed. How to use  Glide aggregate in the above script  

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader