Clientscript on Detail Page vs Edit Page for Leads

Hi all,

I'm trying to get a Zoho CRM Client Script working on the Detail Page (Standard) of the Leads module, using the Event Inquiry layout. It works perfectly on the Edit Page, but I'm unable to get the same logic to run in the Detail view.

Use Case:

I'm using a subform (Products_List) where each row includes a Product lookup and an Associated Vendor lookup. The goal is to automatically populate (or clear) the Associated Vendor field based on the selected Product. If the product is removed or has no linked vendor, the Associated Vendor should be cleared.

Working Setup:

On the Edit Page, I run the following Client Script:

  • Module: Leads

  • Layout: Event Inquiry

  • Subform: Products_List

  • Trigger: onCellChange

// Name: updateProductVendor
// Trigger: onCellChange
// Subform: Products_List

void function updateProductVendorWrapper() {
	try {
		log("[updateProductVendor] Starting Products_List subform vendor updater");

		const subform = ZDK.Page.getSubform("Products_List");
		const rows = subform.getValues();
		log(`Total subform rows: ${rows.length}`);

		const updatedRows = [];

		for (let i = 0; i < rows.length; i++) {
			const row = rows[i];
			const productId = row.Product?.id;

			if (!productId) {
				log(`Row ${i}: No product selected. Clearing Associated Vendor.`);
				updatedRows.push({ ...row, Associated_Vendor: null });
				continue;
			}

			log(`Row ${i}: Fetching product by ID: ${productId}`);
			const product = ZDK.Apps.CRM.Products.fetchById(productId);
			log(`Row ${i}: Product fetched:`, product);

			const vendorId = product.Artist_Lookup_Id;
			if (!vendorId) {
				log(`Row ${i}: No vendor associated. Clearing Associated Vendor.`);
				updatedRows.push({ ...row, Associated_Vendor: null });
				continue;
			}

			log(`Row ${i}: Found Associated Vendor ID: ${vendorId}`);
			const vendor = ZDK.Apps.CRM.Contacts.fetchById(vendorId);
			log(`Row ${i}: Vendor fetched:`, vendor);

			const vendorName =
				vendor.Artist_Name1 ||
				vendor.Full_Name ||
				(vendor.First_Name && vendor.Last_Name
					? vendor.First_Name + " " + vendor.Last_Name
					: "Unknown Vendor");

			log(`Row ${i}: Vendor name resolved as: ${vendorName}`);

			updatedRows.push({
				...row,
				Associated_Vendor: {
					id: vendorId,
					name: vendorName
				}
			});
		}

		subform.setValues(updatedRows);
		log("[updateProductVendor] Vendor assignment process complete.");
	} catch (err) {
		error("Error in updateProductVendor:", err);
	}
}();
 

Problem:

This script works great on the Edit Page, but on the Detail Page, the same onCellChange trigger doesn’t seem to function. From debugging, I noticed that the event object appears to be undefined, and even basic log messages don’t fire unless I remove all use of event.

What I’ve Tried:

  • Setting the script on the Detail Page with the same configuration (module, layout, subform, trigger).

  • Adding verbose logging to confirm the script runs (it doesn't).

  • Removing event references entirely.

  • Confirming the API name of the subform is correct.

  • Trying alternate subform triggers, though only onCellChange is currently available.

Question:

Has anyone successfully gotten a subform-triggered Client Script to work on a Detail Page? Is there a different event or strategy I should be using for Detail views? Or is this a known limitation?

Any help would be appreciated. Thanks in advance!

– Shea