Deluge and Books with line items

Deluge and Books with line items

Hi.
I am trying to code a solution that looks at invoice line item in a workflow and if they contain certain products updates CRM module.
I have been slowly trying to learn deluge but am stuck.
I have managed to grab the invoice data and can pullout various elements as I need them but line items is only ever giving me the first item. Even when I created a loop. Have I missed something or more likely I am going at it the wrong way.
I would love a point in the correct direction please.



  1. invoiceId = invoice.get("invoice_id");
  2. organizationId = organization.get("organization_id");
  3. invoiceRecord = zoho.books.getRecordsByID("invoices",organizationId,invoiceId,"zohobooks").get("invoice");
  4. customerId = invoiceRecord.get("customer_id");
  5. dateIn = invoiceRecord.get("date");
  6. info customerId;
  7. info dateIn;
  8. info invoiceRecord;
  9. lineitem = invoiceRecord.toJSONlist();
  10. for each  product_json in lineitem
  11. {
  12. itemmap = lineitem.toMap();
  13. name = itemmap.get("line_items").getJson("name");
  14. //name2 = name.get(product_json);
  15. }
  16. info name;
  17. info product_json;

    Zoho Marketing Automation

            Zoho Pagesense Resources

              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