Create Pop up notification on Contacts that there's an "Open Deal".

Create Pop up notification on Contacts that there's an "Open Deal".

I am trying to create Pop up notification on Contacts whenever there's an "Open Deal" on that contact.

I am new to Zoho but figured out that this can be done with a Client Script. I got the code below and created the script however its not working.

What am I missing?

function showOpenDealNotification() {
var contactId = ZDK.Page.getRecordId(); // Get the current Contact ID
var relatedDeals = ZDK.RelatedList.getRecords("Deals", contactId); // Get related Deals

for (var i = 0; i < relatedDeals.length; i++) {
var dealStage = relatedDeals[i].getFieldValue("Stage"); // Access Deal Stage
if (dealStage != "Closed Won" && dealStage != "Closed Lost") { // Check if Deal is open
ZDK.Client.alert("Open Deal Alert", "This contact has an open deal: " + relatedDeals[i].getFieldValue("Deal Name"));
break; // Exit loop after displaying one alert
}
}
}

// Call the function when the page loads
ZDK.Page.addEventListener("onload", showOpenDealNotification);