Automatically calculating pricing

Automatically calculating pricing

Hello Zoho Community,

I am trying to automate the process of updating a currency field with a product's price based on selections made in three different lookup fields in Zoho Creator. However, the workflow doesn’t seem to be working as expected, and I'm not seeing any logs being generated, which makes troubleshooting difficult.

Here’s the script I’m currently using:

  1. info "Script started";
  2. // Fetch the values of the lookup fields
  3. standard_coffin_range = input.Standard_Coffin_Range;
  4. return_to_sender_coffin_range = input.Return_To_Sender_Coffin_Range;
  5. casket_range = input.Casket_Range;
  6. // Initialize the price variable
  7. price = 0.0;
  8. // Mapping coffin names to their prices
  9. coffin_prices = Map();
  10. coffin_prices.put("WAYFARER",2995.00);
  11. // Return to Sender
  12. coffin_prices.put("FERNWOOD",2495.00);
  13. // Return to Sender
  14. coffin_prices.put("ARTISAN",3995.00);
  15. // Return to Sender
  16. coffin_prices.put("ARCHETYPE BEECH",3995.00);
  17. // Return to Sender
  18. coffin_prices.put("CAMPHOR LAUREL",4295.00);
  19. // Standard
  20. coffin_prices.put("BLACKWOOD",4295.00);
  21. // Standard
  22. coffin_prices.put("KARRAGARRA",2995.00);
  23. // Standard
  24. coffin_prices.put("LAWSON",3495.00);
  25. // Standard
  26. coffin_prices.put("COOCHIEMUDLO",2995.00);
  27. // Standard
  28. coffin_prices.put("PEEL",2995.00);
  29. // Standard
  30. coffin_prices.put("NATURE",2395.00);
  31. // Standard
  32. coffin_prices.put("KING",2995.00);
  33. // Standard
  34. coffin_prices.put("PEARL",3395.00);
  35. // Standard
  36. coffin_prices.put("SANDGATE",2495.00);
  37. // Standard
  38. coffin_prices.put("AMITY ROSE",2995.00);
  39. // Standard
  40. coffin_prices.put("STRADBROKE",2495.00);
  41. // Standard
  42. coffin_prices.put("MORETON",2295.00);
  43. // Standard
  44. coffin_prices.put("AMITY WHITE",2995.00);
  45. // Standard
  46. coffin_prices.put("BURLEIGH",2995.00);
  47. // Standard
  48. coffin_prices.put("FLINDERS",2595.00);
  49. // Standard
  50. coffin_prices.put("MACLEAY",1995.00);
  51. // Standard
  52. coffin_prices.put("DUNWICH",1595.00);
  53. // Standard
  54. coffin_prices.put("RUSSELL",1395.00);
  55. // Standard
  56. coffin_prices.put("LAMB",1195.00);
  57. // Standard
  58. coffin_prices.put("GOLDEN JEWEL METAL CASKET",4995.00);
  59. // Casket
  60. coffin_prices.put("DIPLOMAT STAINLESS STEEL CASKET",5995.00);
  61. // Casket
  62. coffin_prices.put("MONARCH METAL CASKET",6995.00);
  63. // Casket
  64. coffin_prices.put("HARMONY METAL CASKET",7995.00);
  65. // Casket
  66. coffin_prices.put("ONYX METAL CASKET",8995.00);
  67. // Casket
  68. coffin_prices.put("ROSETTA METAL CASKET",9995.00);
  69. // Casket
  70. coffin_prices.put("SILVER JEWEL METAL CASKET",10995.00);
  71. // Casket
  72. // Check which lookup field has a value and fetch the corresponding price
  73. if(standard_coffin_range != null)
  74. {
  75. price = coffin_prices.get(standard_coffin_range.toUpperCase());
  76. info "Price set from Standard Coffin Range: " + price;
  77. }
  78. else if(return_to_sender_coffin_range != null)
  79. {
  80. price = coffin_prices.get(return_to_sender_coffin_range.toUpperCase());
  81. info "Price set from Return To Sender Coffin Range: " + price;
  82. }
  83. else if(casket_range != null)
  84. {
  85. price = coffin_prices.get(casket_range.toUpperCase());
  86. info "Price set from Casket Range: " + price;
  87. }
  88. // Set the Coffin/Casket Fee (inc GST) field with the fetched price
  89. input.Coffin_Casket_Fee_inc_GST = price;
  90. info "Final Price set: " + price;

Issues I'm Facing:

  1. Workflow Not Logging: Despite adding info statements, nothing appears in the logs, which makes it difficult to troubleshoot.
  2. No Price Update: The currency field (Coffin_Casket_Fee_inc_GST) is not being updated with the price based on the lookup field selections.

What I’ve Checked:

  • The field link names are correct.
  • The workflow is supposed to trigger on user input for the lookup fields.
  • I’ve verified that the map contains the correct price values.

Questions:

  • Is there something I'm missing in the script that could cause the workflow to not trigger?
  • Could the currency field type be causing issues with setting the price?

Any guidance or suggestions on how to resolve this issue would be greatly appreciated.

Thank you in advance!


    Zoho Desk Resources

    • Desk Community Learning Series


    • Digest


    • Functions


    • Meetups


    • Kbase


    • Resources


    • Glossary


    • Desk Marketplace


    • MVP Corner


    • Word of the Day


      Zoho CRM Plus Resources

        Zoho Books Resources


          Zoho Subscriptions Resources

            Zoho Projects Resources


              Zoho Sprints Resources


                Zoho Orchestly Resources


                  Zoho Creator Resources


                    Zoho WorkDrive Resources



                      Zoho Campaigns Resources

                        Zoho CRM Resources

                        • CRM Community Learning Series

                          CRM Community Learning Series


                        • Tips

                          Tips

                        • Functions

                          Functions

                        • Meetups

                          Meetups

                        • Kbase

                          Kbase

                        • Resources

                          Resources

                        • Digest

                          Digest

                        • CRM Marketplace

                          CRM Marketplace

                        • MVP Corner

                          MVP Corner




                          Zoho Writer Writer

                          Get Started. Write Away!

                          Writer is a powerful online word processor, designed for collaborative work.

                            Zoho CRM コンテンツ




                              ご検討中の方