Client Script help for setting a listener

Client Script help for setting a listener

Hello Zoho Community,

I need assistance with modifying my current client script.

Current Setup

  • I have a client script on the Quote module within CRM, which is set to run on the Edit Page.
  • The script is triggered by a Field Event on a checkbox field called Update Service Fee.
  • When this checkbox is checked, the script calculates 18% of the Sub Total value and displays it in the New Service Fee field.

Issue

  • The script functions correctly when the checkbox is checked.
  • However, I would prefer that the New Service Fee value updates automatically whenever the Sub Total value changes, without needing to check the Update Service Fee box each time.

Attempted Solutions

  • I’ve tried several JavaScript listeners to detect changes in the Sub Total field, but none have worked as expected.

Current Script

Here’s the basic script I’m currently using:


var total = ZDK.Page.getField('Sub_Total').getValue();
var sub = ZDK.Page.getField("New_Service_Fee").getValue();
var service_fee = total * 0.18;
ZDK.Page.getField("New_Service_Fee").setValue(service_fee);


Request

Could you please guide me on how to modify the script so that the New Service Fee field updates automatically every time the Sub Total field changes?

Thank you for your help.

    Access your files securely from anywhere

        Zoho Developer Community




                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation


                                              Manage your brands on social media



                                                    Zoho TeamInbox Resources

                                                      Zoho DataPrep Resources



                                                        Zoho CRM Plus Resources

                                                          Zoho Books Resources


                                                            Zoho Subscriptions Resources

                                                              Zoho Projects Resources


                                                                Zoho Sprints Resources


                                                                  Qntrl Resources


                                                                    Zoho Creator Resources



                                                                        Zoho Campaigns Resources


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • Functions

                                                                            Functions

                                                                          • Meetups

                                                                            Meetups

                                                                          • Kbase

                                                                            Kbase

                                                                          • Resources

                                                                            Resources

                                                                          • Digest

                                                                            Digest

                                                                          • CRM Marketplace

                                                                            CRM Marketplace

                                                                          • MVP Corner

                                                                            MVP Corner





                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now