Function #22: Associate salesperson automatically based on customer-level custom field

Function #22: Associate salesperson automatically based on customer-level custom field

Many businesses rely on salespersons to engage with customers and facilitate sales transactions on behalf of the company. These sales representatives often handle multiple clients simultaneously, and it becomes essential to correctly link each salesperson to the transactions belonging to their respective customers. This action is necessary for calculating the sales revenue generated by each salesperson. 

Usually, when you create an invoice for a customer in Zoho Books, you must manually select the salesperson responsible for that particular transaction. However, the custom function we're sharing today is designed to automate the association of salesperson based on the customer selected in the transaction. 

Prerequisites: 

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



2. Create a dropdown-type custom field labeled "Salesperson" for the Customers module. Populate the dropdown options with the names of the salespeople in your organization. 



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 you can update the salesperson at the customer level:

1. For new customers - During customer creation, you can select the salesperson from the dropdown custom field that was created for this purpose.
2. For existing customers - You have two options, either update the salesperson information using the "Bulk update" option or export the customer data, add the salesperson details in the Excel sheet, and then re-import the file using the Overwrite option. 

Now, whenever an invoice is created and saved, the custom function will get executed and the salesperson chosen at the customer level will be associated with the invoice.

If you wish to implement this automation for other types of sales transactions like Estimates, Sales Orders, or Credit Notes, please contact support[at]zohobooks[dot]com, and we'll assist you.

Regards,
Shireen Farhana
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

                                                                          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