Function #19: Associate invoice templates automatically based on branch

Function #19: Associate invoice templates automatically based on branch

Much like the custom function we shared last week, today's function also aims to facilitate the automatic association of invoice templates. 

When you're managing business operations across various branches, there may be a need to create and send invoices using templates that are specific, to each branch. To handle this, you can design invoice templates for each branch and simply name each template after its corresponding branch. After this setup, you can automate the template selection using a custom function. This function, when executed, will automatically associate the appropriate template at the invoice level based on the branch chosen in the invoice.
Note: Branches are available in Global, UAE, KSA, Bahrain, UK, Oman, Qatar, Kuwait, and South Africa editions. 


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

2. Create invoice templates for every branch and label each template according to its respective branch. For example, if you're designing a template for the branch named "Head Office", the template should be labeled as "Head Office".

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 how the custom function will work:

Once you create and save an invoice in draft, the custom function will be executed. The function will check the branch chosen in the invoice and then automatically associate the corresponding template. 

We believe that this custom function will be valuable in reducing the need for manual work. Please don't hesitate to share your thoughts or feedback regarding our custom functions. We would greatly appreciate hearing your opinions.

Shireen Farhana S
Zoho Books

    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


                                                                      • Functions


                                                                      • Meetups


                                                                      • Kbase


                                                                      • Resources


                                                                      • Digest


                                                                      • CRM Marketplace

                                                                        CRM Marketplace

                                                                      • MVP Corner

                                                                        MVP Corner



                                                                          Design. Discuss. Deliver.

                                                                          Create visually engaging stories with Zoho Show.

                                                                          Get Started Now