DYNAMICALLY DELETE ROWS IN SUBFORM 2 BASED ON SUBFORM 1

DYNAMICALLY DELETE ROWS IN SUBFORM 2 BASED ON SUBFORM 1

  1. I have a purchase order form that contains Purchase Order No and a subform named Purchase Order
  2. I have a commercial invoice form that contains a subform named Line Items
  3. In the commercial invoice form, I added a subform named Purchase Order
  4. In the Purchase Order subform , I added a lookup field that will look up the Purchase Order No from purchase order form
  5. I created a script, On user input of the look-up field. Every line item associated on that selected Purchase Order No, will be inserted to Line Items subform in Commercial Invoice.
  6. I already achieved that goal, the challenge for me now is that, when I tried to remove or delete the Purchase Order No in the look up or delete the row, the associated line items from Line Items subform can't be deleted, currently when I tried to remove or change the Purchase Order No, all the line items will be deleted, which is not the goal, I need help on how to handle this scenario. To dynamically delete associated line items based on Purchase Order No.

    BELOW IS MY CURRENT SCRIPT , I also attached a recording with this. Thank you

  7. if(row.PO_Number.isEmpty() == false)
  8. {
  9. variable = Purchase_Orders[ID = row.PO_Number];
  10. values1 = Collection();
  11. for each  elem in variable.Line_Items
  12. {
  13. // input.Line_Items.clear();
  14. row1 = Commercial_Invoices.Line_Items();
  15. row1.PO_Number_Tracer=variable.PO_Number;
  16. row1.Description=elem.Item_Name;
  17. row1.Quantity=elem.Item_Quantity;
  18. row1.Unit_Price=elem.Item_Unit_Price;
  19. row1.Amount=elem.Item_Amount;
  20. values1.insert(row1);
  21. }
  22. input.Line_Items.insert(values1);
  23. }
  24. else
  25. {
  26. input.Line_Items.clear();
  27. coll = Collection();
  28. for each  rec in input.Line_Items
  29. {
  30. if(rec.PO_Number_Tracer != row.PO_Number.toString())
  31. {
  32. row1 = Commercial_Invoices.Line_Items();
  33. row1.PO_Number_Tracer=rec.PO_Number_Tracer;
  34. coll.insert(row1);
  35. }
  36. }
  37. // input.Line_Items.clear();
  38. input.Line_Items.insert(coll);
  39. }
  40. //Case NO
  41. count = 1;
  42. for each  rec in input.Line_Items
  43. {
  44. rec.No=count;
  45. count = count + 1;
  46. }
  47. count = 1;
  48. for each  rec in input.Line_Items
  49. {
  50. rec.Case_Nr=count;
  51. count = count + 1;
  52. }

      Zoho SalesIQ Resources



            Zoho TeamInbox Resources

              Zoho DataPrep Resources


                  Zoho CRM Plus Resources

                    Zoho Books Resources


                      Zoho Subscriptions Resources

                        Zoho Desk Resources

                          Zoho Projects Resources


                            Zoho Sprints Resources


                              Qntrl Resources


                                Zoho Creator Resources


                                  Zoho WorkDrive Resources




                                      Zoho Campaigns Resources

                                        Zoho CRM Resources

                                                    Design. Discuss. Deliver.

                                                    Create visually engaging stories with Zoho Show.

                                                    Get Started Now


                                                      Zoho Show Resources


                                                        Zoho Writer Writer

                                                        Get Started. Write Away!

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

                                                                  有料プランをご利用の方