Open general ledger from trial balance for party

I want to open general ledger for party when click on customer from “Trial balance for party” report.
Many thanks in advance.

hi @Chirag_Parmar

Refer below code, it will helps to full fill your requirement

Hello @rohit_w

Thanks for reply.

I have already refer that code and write below code in trial_balance_for_party.js.

“formatter”: function(row, cell, value, columnDef, dataContext, default_formatter) {
if (columnDef.df.fieldname==“party”) {
value = dataContext.party_name;

		columnDef.df.link_onclick = "erpnext.trial_balance_for_party.open_general_ledger(" + JSON.stringify(dataContext) + ")";
		// columnDef.df.is_tree = true;

	value = default_formatter(row, cell, value, columnDef, dataContext);

	return value;
"open_general_ledger": function(data) {
 	if (!data.account) return;

 	frappe.route_options = {
 		"account": data.account,
 		"from_date": data.from_date,
 		"to_date": data.to_date
 	frappe.set_route("query-report", "General Ledger");
 	// frappe.set_route("query-report", "Account Balance Register");

But it display some console error like below.

Uncaught TypeError: Cannot read property ‘open_general_ledger’ of undefined
at HTMLAnchorElement.onclick (VM504 Trial Balance for Party:1)

Use below code

"frappe.query_reports['Trial Balance for Party'].open_general_ledger(" + JSON.stringify(dataContext) + ")";

Hello @rohit_w

Its Working.
Many thanks.