Function #11: Apply unused credits automatically to invoices

Function #11: Apply unused credits automatically to invoices

Today, we bring you a custom function that automatically applies unused credits from excess payments, credit notes, and retainer payments to an invoice when it is created.



Create a Connection named "zbooks" to successfully execute the function. You can watch the GIF attached below to know how to create the connection. 



Note: To ensure a systematic approach, the application of unused credits will follow the order of excess payments first, then credit notes, and finally retainer payments.

Custom Function:

Navigate to Settings -> Automation -> Custom Functions -> +New Custom Function > Add the function code from this GitHub link.


Workflow Rule: 


Go to Settings -> Automation -> Workflow Rules -> +New Workflow Rule and set up the workflow rule as shown below:-


In the final step of this workflow rule, associate the custom function you created and then hit Save.

Here's a GIF of how the unused credits will be applied, once you create and save an invoice.


With this function in place, you no longer need to apply the unused credits manually. Instead, the system will identify any available credits and automatically apply them after you create an invoice. 


If you need any assistance with setting up the function, do not hesitate to reach out to us at support[at]zohobooks[dot]com.


Shireen Farhana S

Zoho Books.