Strange deluge error trying to access data from List

Strange deluge error trying to access data from List

Hi all,

Some background on my problem:

I have a form that accepts some values from keyboard input pictured below.



The form section values are named "Non_Discountable_1" and "Non_Discountable_1_Quantity" from 1-10. 

The left field is a multi option dropdown, and the right field is a int.

The multi field drop down is populated by a script on form load, because I want the ability to change values later without having to adjust the form.

Here is how I set the dropdown values through a workflow when the form is loaded:
  1. //SET non discountable
  2. demoPricebook = Collection();
  3. demoPricebook = thisapp.returnPriceBook("demoPricebook");
  4. keyList = List();
  5. keyList = demoPricebook.keys();
  6. clear Non_Discountable_1;
  7. clear Non_Discountable_2;
  8. clear Non_Discountable_3;
  9. clear Non_Discountable_4;
  10. clear Non_Discountable_5;
  11. clear Non_Discountable_6;
  12. clear Non_Discountable_7;
  13. clear Non_Discountable_8;
  14. clear Non_Discountable_9;
  15. clear Non_Discountable_10;
  16. for each index indexNum in keyList
  17. {
  18. input.Non_Discountable_1:ui.append(keyList.get(indexNum));
  19. input.Non_Discountable_2:ui.append(keyList.get(indexNum));
  20. input.Non_Discountable_3:ui.append(keyList.get(indexNum));
  21. input.Non_Discountable_4:ui.append(keyList.get(indexNum));
  22. input.Non_Discountable_5:ui.append(keyList.get(indexNum));
  23. input.Non_Discountable_6:ui.append(keyList.get(indexNum));
  24. input.Non_Discountable_7:ui.append(keyList.get(indexNum));
  25. input.Non_Discountable_8:ui.append(keyList.get(indexNum));
  26. input.Non_Discountable_9:ui.append(keyList.get(indexNum));
  27. input.Non_Discountable_10:ui.append(keyList.get(indexNum));
  28. }

Once the values are chosen and form is submitted, I am attempting to access these field selections from a ZML script with deluge deluge and display them on said sales page. 

Here is an excerpt of the script from the ZML on the sales page that defines the List that contains the elements from the form fields. 

  1. //ASSIGN DEMO AND ETC
  2. nonDCItems = List();
  3. if(Quote_Builder[ID == input.firstQuoteID].Non_Discountable_1_Quantity > 0 && Quote_Builder[ID == input.firstQuoteID].Non_Discountable_1_Quantity != null)
  4. {
  5. nonDCItems.add(Quote_Builder[ID == input.firstQuoteID].Non_Discountable_1);
  6. }
  7. if(Quote_Builder[ID == input.firstQuoteID].Non_Discountable_2_Quantity > 0 && Quote_Builder[ID == input.firstQuoteID].Non_Discountable_2_Quantity != null)
  8. {
  9. nonDCItems.add(Quote_Builder[ID == input.firstQuoteID].Non_Discountable_2);
  10. }
  11. if(Quote_Builder[ID == input.firstQuoteID].Non_Discountable_3_Quantity > 0 && Quote_Builder[ID == input.firstQuoteID].Non_Discountable_3_Quantity != null)
  12. {
  13. nonDCItems.add(Quote_Builder[ID == input.firstQuoteID].Non_Discountable_3);
  14. }
  15. if(Quote_Builder[ID == input.firstQuoteID].Non_Discountable_4_Quantity > 0 && Quote_Builder[ID == input.firstQuoteID].Non_Discountable_4_Quantity != null)
  16. {
  17. nonDCItems.add(Quote_Builder[ID == input.firstQuoteID].Non_Discountable_4);
  18. }
  19. if(Quote_Builder[ID == input.firstQuoteID].Non_Discountable_5_Quantity > 0 && Quote_Builder[ID == input.firstQuoteID].Non_Discountable_5_Quantity != null)
  20. {
  21. nonDCItems.add(Quote_Builder[ID == input.firstQuoteID].Non_Discountable_5);
  22. }
  23. if(Quote_Builder[ID == input.firstQuoteID].Non_Discountable_6_Quantity > 0 && Quote_Builder[ID == input.firstQuoteID].Non_Discountable_6_Quantity != null)
  24. {
  25. nonDCItems.add(Quote_Builder[ID == input.firstQuoteID].Non_Discountable_6);
  26. }
  27. if(Quote_Builder[ID == input.firstQuoteID].Non_Discountable_7_Quantity > 0 && Quote_Builder[ID == input.firstQuoteID].Non_Discountable_7_Quantity != null)
  28. {
  29. nonDCItems.add(Quote_Builder[ID == input.firstQuoteID].Non_Discountable_7);
  30. }
  31. if(Quote_Builder[ID == input.firstQuoteID].Non_Discountable_8_Quantity > 0 && Quote_Builder[ID == input.firstQuoteID].Non_Discountable_8_Quantity != null)
  32. {
  33. nonDCItems.add(Quote_Builder[ID == input.firstQuoteID].Non_Discountable_8);
  34. }
  35. if(Quote_Builder[ID == input.firstQuoteID].Non_Discountable_9_Quantity > 0 && Quote_Builder[ID == input.firstQuoteID].Non_Discountable_9_Quantity != null)
  36. {
  37. nonDCItems.add(Quote_Builder[ID == input.firstQuoteID].Non_Discountable_9);
  38. }
  39. if(Quote_Builder[ID == input.firstQuoteID].Non_Discountable_10_Quantity > 0 && Quote_Builder[ID == input.firstQuoteID].Non_Discountable_10_Quantity != null)
  40. {
  41. nonDCItems.add(Quote_Builder[ID == input.firstQuoteID].Non_Discountable_10);
  42. }
It basically checks if the Quantity field  on the form is higher than 0, and if so, it saves the name of the dropdown field into the list.

Here is the code that I am using later in the script to access the list names.

  1. //STARTS THE FOR EACH MACRO FOR DEMO ITEMS + NON DISCOUNTABLE ITEMS
  2. <%
  3. for each  item in nonDCItems
  4. {
  5. %>
  6. <pr width='fill' height='auto'>
  7.         <pc padding='0px' width='50%'>
  8.           <pr width='auto' height='auto'>
  9.             <pc>
  10.               <text marginLeft='20px' marginBottom='5px' marginTop='5px' color='#1F58B8' size='16px' fontFamily='roboto-regular' type='Text' bgColor='rgba(0, 0, 0, 0)' value='<%=item%> '> </text>
  11.   
  12.             </pc>
  13.           </pr>
  14.         </pc>
  15.         <pc padding='0px' bgColor='transparent' width='50%' hAlign='right' vAlign='middle'>
  16.           <pr width='auto' height='auto'>
  17.             <pc>
  18.               <text marginRight='20px' marginBottom='5px' marginTop='5px' color='#1F58B8' size='16px' fontFamily='roboto-regular' type='Text' bgColor='rgba(0, 0, 0, 0)' value=''> </text>
  19.             </pc>
  20.           </pr>
  21.         </pc>
  22.       </pr>
  23. <%
  24. }
  25. %>

Here is where things get weird.

Remember how I loaded the dropdown options for the form fields from a script on form load?

If any of these variables are selected in the form, I get a ZML error. 



If I go back into the reports and edit the form in said area, I notice that the pre-populated options are no longer there and are replaced with the default choices. "Choice 1, Choice 2, Choice 3"

If I select from these choices and remove the choices with the pre populated variables, the code works and displays as intended:



I am confused on how to proceed.

It seems the problem exists somewhere in how I have chosen to prepopulate the fields, because the code only works when none of those fields are selected.

Please advise!
    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 コンテンツ




                              ご検討中の方