What?
An article on something that has taken me several days to get working: Get Zoho Books or Zoho Inventory that when an invoice is marked as paid, update 2 custom fields with the Payment Method, and the Payment Date.
Why?
This was requested by a customer and the problem happened in that the workflow would simply not trigger when the invoice was paid. The customer had added 3 custom fields: Payment Method, Payment Date, and Last Four Digits. They needed these because sometimes their customers needed to know what card they had paid with (if paid by card). The customer wanted payment method and payment date to appear on the invoice.
How?
This sounds rather straightforward, write a function that given an invoice, checks the customer payments and updates the custom fields. Executing the function this worked as expected. Now put it on a workflow where the settings were:
- When an invoice is "Created or Edited"
- Execute the workflow when "When any field is updated"
- Filter the triggers when Status is "Paid"
- Just once or every time is "Everytime"
- Actions is a custom function called "fn_invoice_updatepaymentmethod"
But this wouldn't work despite being as per the documentation (see sources below).