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);
    • Sticky Posts

    • Zoho CRM Plus in 2023: Let's rewind

      Hey everyone, There's something about December that makes us want to sit back and remember all the wonderful moments, as we get ready for the New Year, 2024! (Psst! We are also turning 10—yay!) This year, CRM Plus had a lot of wonderful updates, taking
    • The CX Workshops are back in 2023!

      Hello, can you see my screen? Can you hear me? This is a phrase we've all been saying more often than "good morning" over the last couple of years. Well, now it's time to re-connect in person. We're excited to invite you all to the CX Workshops we've
    • Refer Zoho CRM Plus to your friends and earn rewards!

      Hey everyone,   We'd like to thank you from the bottom of our hearts for continuing to be our esteemed customers. Now you have the opportunity to refer Zoho CRM Plus to your friends or family members who are looking for a suitable solution to enhance
    • Social in CRM Plus now supports TikTok, Instagram Stories and Reels, and YouTube Shorts

      Hey everyone,   We are excited to inform you that Social in CRM Plus now allows you to publish on TikTok! We've also updated it to let you create Instagram Stories and Reels, as well as YouTube Shorts. Here's a brief about the updates.  Publishing on
    • Unified telephony in Zoho CRM Plus

      In any business, managing calls with the prospects or customers is an integral part of a salesperson or a support agent's daily life. They have access to information about the customers within Zoho CRM, and they also use a suitable PBX service to communicate