Tip #7 Applying a preset credit card charge to a sales order

Tip #7 Applying a preset credit card charge to a sales order

Good day!

Previously, we saw how we could automate vendor notification emails against purchase deliveries. Today, we will see how we can apply a percentage of the total amount as a credit charge to your sales orders.

How does it work?

Well, we add a string type custom field to capture credit card charges to the sales order module via preferences. Then we navigate to custom functions under automation, we specify the value for the custom field (yes/no) and set a percentage for credit card charges to be applied to a sales order whenever a Zoho Inventory user types "yes" inside of that custom field and saves the sales order. 

Setting up the custom function:
  • Log in to your Zoho Inventory organization.

  • Click on the gear icon from the top-right corner. Select Preferences from the drop-down.

  • Navigate to Sales Orders under Preferences and add a new custom field of type string. The name of the custom field can be something of your choice (but this name has to be updated inside of the custom function code snippet later). 

  • After creating the custom field, navigate to Automation.

  • Now click on the button adjacent to +New Workflow Rule.

  • Out of the four options from the drop-down, select Custom Functions.

  • Now let's add a name to this workflow rule and make sure that there are no spaces between words.

  • Select Sales Orders against module.

  • Add a description if you need one.

  • Now, the workflow type is going to be Event Based.

  • The condition to set shall be, "when a Sales Order is created".

  • Now copy and paste this code snippet inside the deluge pane:

salesorderID = salesorder.get("salesorder_id");

salesorderdate = salesorder.get("date").toDate();
organizationID = organization.get("organization_id");
for each cf in cfs
bson.put("adjustment_description","Credit card charges");
percent= 3/100 * tot;
res=zoho.inventory.updateRecord("SalesOrders", organizationID, salesorderID, bson);
info res.toMap().get("message");
info "Not Applicable";
  • Navigate to this line - lab=cf.get("label").toString(); and replace "label" with the name of the custom field.

  • Navigate to this line - percent= 3/100 * tot; in order to change the percentage applied.

  • Alternatively, you can also use a checkbox type custom field. However, you will need to modify the code snippet a bit to make it work.

  • Note: The credit card charges will be updated to the Adjustments field above the grand total. And the label of the Adjustment field will be changed to "Credit card charges". 

  • Hit Save to finish.

 Hence forth, whenever you generate a sales order, you can apply credit card charges to it by typing "Yes" inside of the custom field made by you and a % of the total (as given by you) will be applied to the total amount. Hope this helps you with your sales endeavours.

Until next time.

Your everyday end user,
Ajay Aadhithya Chandrasekaran
Zoho Inventory

    Zoho Marketing Automation

              Zoho Pagesense Resources

                Zoho SalesIQ Resources

                      Zoho TeamInbox Resources

                        Zoho DataPrep Resources

                          Zoho CRM Plus Resources

                            Zoho Books Resources

                              Zoho Subscriptions Resources

                                Zoho Desk Resources

                                  Zoho Projects Resources

                                    Zoho Sprints Resources

                                      Qntrl Resources

                                        Zoho Creator Resources

                                          Zoho WorkDrive Resources

                                              Zoho Campaigns Resources

                                                Zoho CRM Resources

                                                        Design. Discuss. Deliver.

                                                        Create visually engaging stories with Zoho Show.

                                                        Get Started Now