How can I show an Account's total lifetime purchase value?

How can I show an Account's total lifetime purchase value?

Hello, 

I know I am missing something. I want to visualize how much each account has paid us over the time they have been customers (lifetime value). This must have been done before but I can't find a community thread on it.

We do not bill with Zoho Finance/Books, we use Square. So I will have to import transactions or use a Flow to add each transaction as a paid invoice. I think I can do that, but how can I access that information in the Accounts Module?

I had planned to write a Flow to trigger a custom function any time a transaction is posted, using the customer ID number.

I put dummy invoices in Books to test, but I can't get the info to return from the custom function. I've scripted with deluge in Creator, but not using APIs, and I don't understand the API syntax. This what I have:

  1. float Return_Customer_Lifetime_Value(int Ident)
  2. {
  3. //Ident is the customer ID

  4. transactions = zoho.books.getRecords("customerpayment", <some OrgID number> , Ident, "zoho_books_connection");
  5. total = 0;
  6. for each  rec in transactions
  7. {
  8. total = total + "amount";  //how do I refer to the amount properly using an API?
  9. }
  10. return total;
  11. }


    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 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

                                                                      





                                                                      




                                                                          Design. Discuss. Deliver.

                                                                          Create visually engaging stories with Zoho Show.

                                                                          Get Started Now