Tip #3 Automating total item weight calculation for your sales orders in Zoho Inventory

Tip #3 Automating total item weight calculation for your sales orders in Zoho Inventory

Hello,


Hope the day is treating you well.
Last week, we saw how we could automate the calculation of total shipping charges from numerous shipments for your sales orders and invoices. This week, we will see how you can automate the calculation of total item weight for your sales orders. 

How does this work?
First, you are required to capture the weight of all your items using a custom field. And when you create a sales order, you can either have the system display the individual weights for you or you can manually enter new weights. You are also required to define a custom field under sales orders and packages called Weight to capture the total package weight. Through the custom function, the system will then add up the individual weights of items to arrive at a total weight and display it on your sales orders and packages. Later when you ship via a carrier, you can refer manually to this weight and input them into the shipment order to generate shipping rates.

Note: This custom function works only if a sales order has a single package. If there are multiple packages, then please note that this function will display the total weight of all items in the sales order inside of every package and not the total weight of items present inside that package. 

What do you need before writing the custom function?

How do I set it up?

Log in to your Zoho account and click on this link to generate an Auth Token which is required to make this work.

 
  • Open your Zoho Inventory organization.

  • Navigate to Settings using the gear icon from the top-right corner.

  • Select Automation from the sidebar. 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 for this workflow rule and make sure that there are no spaces between words.

  • Choose "Sales Orders" against the module field.

  • Add a description if you need one.

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

  • And for the trigger, we are going to choose the option - "when a Sales Order is created".

In the deluge pane, we are going to copy and paste the following code snippet:


authtoken = "Copy and paste your authtoken here";
salesorderID = salesorder.get("salesorder_id");
salesorderdate = salesorder.get("date").toDate();
organizationID = organization.get("organization_id");
bson=Map();
lineitems=salesorder.get("line_items").toList();
weight=List();
for each line in lineitems
{
cfs=line.get("item_custom_fields").toList();
for each cf in cfs
{
if(cf.get("label").toString().equalsIgnoreCase("weight")) /*replace with item level custom field name*/
{
weight.add(cf.get("value").toDecimal() * line.get("quantity"));
break;
}
}
}
wei=0;
j=0;
for each index j in weight
{
wei=wei + weight.get(j).toDecimal();
}
info wei;
cf=List();
cf1=Map();
cf1.put("label","Weight"); /* replace with sales order custom field */
cf1.put("value",wei);
cf.add(cf1);
customs=salesorder.get("custom_fields").toList();
customs.addAll(cf);
bson.put("custom_fields",customs);
bson.put("customer_id",salesorder.get("customer_id"));
res=zoho.inventory.updateRecord("SalesOrders", organizationID,salesorderID, bson);
info res.toMap().get("message");

  • Before you save, you are required to copy and paste your auth token inside the quotes in the 1st line that says:

    • authtoken = "Copy and Paste your auth token in place of this text";

    • The auth token is a critical piece of information that helps the system identify you, so keep yours safe and confidential. Do not share it with anyone, not even folks from Zoho.

  • Now, hit Save to finish.

Henceforth, the total weight of all your items in a sales order you make will be calculated automatically and updated to the package that is associated with it. 

Don't use this, if you have multiple packages for a single order.


Hope this makes shipping a little more easier for you. Have you tried custom functions for your business? Email us your recipes (scenarios and code snippets), questions and suggestions to support@zoho-inventory.com.


Until next time!


Your everyday end user,

Ajay Aadhithya Chandrasekaran

Zoho Inventory



    • Recent Topics

    • Using IMAP configuration for shared email inboxes

      Our customer service team utilizes shared email boxes to allow multiple people to view and handle incoming customer requests. For example, the customer sends an email to info@xxxx.com and multiple people can view it and handle the request. How can I configure
    • [Bug] WebAuthn passkey registration blocked on rpIds with TLDs longer than 6 characters (.accountant, .technology, etc.) — isValidDomain regex too strict

      Hi, Filing on behalf of an enterprise customer where Zoho Vault is deployed across the company. The Chrome extension blocks WebAuthn passkey registration on legitimate sites whose Relying Party ID (rpId) has a TLD longer than 6 letters. This affects every
    • What's New in Zoho Billing | March 2026

      March is here with a fresh wave of updates to Zoho Billing. From making compliance easier, reporting more flexible, to making day-to-day workflows smoother across the board. Here's everything that's new this month. Introducing Usage-Based Billing Reports
    • Subforms in Creator-Lookup Price

      I've got a modular called Price List with items and prices. Ive got another module called Estimates with a subform that looks up that Price List. I am trying to get the "Price" to auto-enter based on the Lookup field of the item name. Anyone know how
    • Feature request - pin or flag note

      Hi, It would be great if you could either pin or flag one or more notes so that they remain visible when there are a bunch of notes and some get hidden in the list. Sometimes you are looking for a particular name that gets lost in a bunch of less important
    • Map Dependency Upgrades in Zoho CRM

      Map Dependency Fields enhancements are available in CA, SA, JP, CN, UAE, AU and EU DCs. Latest update: Also available in IN and US DCs. Hello everyone, We’ve introduced a set of enhancements to Map Dependency Fields to make setup simpler, faster, and
    • CRM to FSM Setup

      Good Afternoon, I am trying to connect CMS to FSM. My current field mapping is: Companies ↔ Accounts Contacts ↔ Contacts Service And Parts ↔ Products I'm setting this up for an elevator service company. The idea is that: Accounts represent Companies.
    • All new Address Field in Zoho CRM: maintain structured and accurate address inputs

      Availability Update: 29 September 2025: It's currently available for all new sign-ups and for existing Zoho CRM orgs which are in the Professional edition exclusively for IN DC users. 2 March 2026: Available to users in all DCs except US and EU DC. 24
    • Collapsible Sections & Section Navigation Needed

      The flexibility of Zoho CRM has expanded greatly in the last few years, to the point that a leads module is now permissible to contain up to 350 fields. We don't use that many, but we are using 168 fields which are broken apart into 18 different sections.
    • Create custom rollup summary fields in Zoho CRM

      Hello everyone, In Zoho CRM, rollup summary fields have been essential tools for summarizing data across related records and enabling users to gain quick insights without having to jump across modules. Previously, only predefined summary functions were
    • Inventory batch details

      Hi there, I'm trying to get the batch details of an item, here's what I've done so far. I've sent cUrl request to the below endpoint and I get a successful response. Within in the response I find the "warehouses" property which correctly lists all the
    • How do I edit the Calendar Invite notifications for Interviews in Recruit?

      I'm setting up the Zoho Recruit Interview Calendar system but there's some notifications I don't have any control over. I've turned off all Workflows and Automations related to the Calendar Scheduling and it seems that it's the notification that is sent
    • Unable to send emails from iPhone and iPad

      Curious, all of a sudden I'm unable to send emails from iPhone and iPad. I keeps asking for my password again and again. No problems from my MacBook Pro.
    • Journal Entries Do Not Show Multiple Entries to the Same Account

      Another basic accounting function that Books ... Accountants sometimes write journal entries, debiting and/or crediting the same account in the same entry. This is due to the need to record specific activity in an account when we pull reports especially
    • Create static subforms in Zoho CRM: streamline data entry with pre-defined values

      Last modified on (9 July, 2025): This feature was available in early access and is currently being rolled out to customers in phases. Currently available for users in the the AU, CA, and SA DCs. It will be enabled for the remaining DCs in the next couple
    • Partial customer Refund via customer Credit Card used to pay invoice

      How can we process a partial refund through the same credit card that a customer used to pay the initial invoice? - In other words, say a customer was sent an invoice for $1200.00 and they paid it through Zoho with our online credit processor, PayFlow
    • Partial refunds

      I am trying to process refund for a one item invoice, however the refund is partial: i am getting this error while creating credit note, can anyone share some wisdom about this
    • How in the heck do i record a (partial) refund???

      I have a client. wrote an invoice for 3 services totalling $520. He paid it online (we use zoho to authorize.net) We went out and couldn't do one of the services I didn't see a way to initiate a refund through zoho books, so i did a $250 refund through authorize.net. Tried to edit the payment on zoho books, but it won't let me b/c "this payment was made on line" When i try to edit the invoice i get a popup about it no longer matching the payment. What do I do??? And why is it so hard to do something
    • Action Required: Update your Zoho Projects – Zoho Analytics integration

      Dear Zoho Projects integration users, We would like to inform you about an upcoming update to the Zoho Projects–Zoho Analytics integration. Read the full migration announcement here. As shared in the announcement, we are updating the integration to support
    • Whatsapp Limitation Questions

      Good day, I would like to find out about the functionality or possibility of all the below points within the Zoho/WhatsApp integration. Will WhatsApp buttons ever be possible in the future? Will WhatsApp Re-directs to different users be possible based
    • Mirror Component in Zoho CRM: Access real-time related data without leaving your record

      Hi everyone, This feature is now available for the JP, CA, SA, UAE, and AU DCs. We're excited to bring to you Zoho CRM's mirror component, which presents relevant data on a record's details page and keeps everything users need in one place without having
    • Workflows fail silently in Zoho CRM and there is no native way to know

      Workflow automation is honestly one of the biggest reasons my clients choose Zoho. But there is one problem I keep running into across almost every implementation. When a workflow fails, nobody finds out. Email alerts hit daily limits and just stop. Custom
    • Office365(outlook emails) Zoho CRM integration

      Hi guys We're looking to buy Zoho CRM and are currently trialling. I'm working from a MacBook fyi. I've so spent 3 hours on live chat today with Zoho as we couldn't get the two to integrate properly, even with the plug in installed but finally managed
    • When adding subform records, how do I access member fields of a name field

      I have the following code (runs when a record is added to a form) if (input.P_liza != null) { input_deal = input.P_liza; rec = form_mapping[deal_name == input_deal]; id = input.N_mero_de_documento_de_Identificaci_n_Alfanum_rico; contact = -----redacted------.get_crm_contact_by_id(id);
    • Making "All Day Events" not default

      When I go to schedule an event, the All Day checkbox is ticked by default. Generally, I don't plan all day events, so is there a way to make that not checked by default? I couldn't find a setting for this...
    • Create custom field in multiple modules

      I am trying to create some custom fields that will be in both leads and contacts module without having to create them separately and then mapping them. How is that performed? it is too time-consuming to create 20+ fields and then do the same thing in a different module when they carry the same info. The idea is that when we get a lead from web site, there are items that we capture and once that lead is a client and moved to Contacts, that info should come over. So trying to find an easy way to create
    • Allow 2 logos for Branding, one for Light Mode and one for Dark Mode?

      Our logo has a lot of black text on it. If we leave the background transparent, per recommendation of Zoho, when a user is viewing a file and turns on dark mode, our logo is not really visible and looks really weird. It would be really great if we could
    • Compensation | Salary Packages - Hourly Wage Needed

      The US Bureau of Labor Statistics says 55.7% of all workers in the US are paid by the hour. I don't know how that compares to the rest of the world, but I would think that this alone would justify the need for having an hourly-based salary package option.
    • Tip #20 - Three things you probably didn't know you can do with picklists

      Hello Zoho Sheet users! We’re back with another quick tip to help you make your spreadsheets smarter. Picklists are a great tool to maintain consistency in your spreadsheet. Manually entering data is time-consuming and often leaves typos and irregular
    • In Desk KB article, how do include an image in a numbered list without using a number or bullet?

      We need to include images in our KBA steps as a numbered list. Here I have numbered steps. I want the image no numbering or bullet. Open Purchase Order Entry. Select the mail icon: Select the Save button. I see your own articles have images in number
    • Video Interview features

      I tested the video interview feature. It's supported only on desktop version of chrome/firefox. Most of the times, the candidates are available on their cellphone. Need to have this for mobile devices too.
    • POS and payments

      Have i missed the point can i not use zoho POS as a payment terminal back into stripe like we can in Books?
    • Delugeサーバーページ(HTML)での関数の使用方法

      Zoho Creator、Deluge並びに初心者です。 題名の通りDelugeサーバーページ(HTML)で関数が使用する方法を教えて頂きたいです。 ざっくりと説明します。 現在、1週間だけカレンダーを表示するページをelugeサーバーページ(HTML)内で作っております。 カレンダー内のボタンには翌週や先週を表示するボタンを追加しようとしています。 それらのボタンを押下した際、現在の日時に±7日をしてページを表示しなおす処理が走るようにさせたいです。 ボタンが押下されたとき、用意していた関数でその処理を実行する想定です。
    • How to Generate Separate Labels for Each Invoice SKU Line Item in Zoho Books?

      Hi everyone, I’m trying to implement a requirement in Zoho Books where separate labels need to be generated for each SKU/item from an invoice. Scenario: One invoice can contain multiple products/SKU items Each item/box should have its own separate label
    • Automatically remove commas

      Team, Please be consistent in Zoho Books. In Payments, you have commas here: But when we copy and paste the amount in the Payments Made field, it does not accept it because the default setting is no commas. Please have Zoho Books remove commas autom
    • Why does my salesiq dashboard doesn't look like the one on the admin guide?

      https://help.zoho.com/portal/en/kb/salesiq-2-0/for-administrators/setup-brand/articles/setting-up-the-website-channel#Launcher
    • ENDPOINT ZOHO CREATOR

      I created a function to perform the action of POST, GET and PUT in order to use it outside our portal and create more dynamic forms using a cloud server. Params = “qAvhbBBJJsQysd45DdkvTR34A” Curl = “https://www.zohoapis.com/creator/custom/admin2844/vallesalud_julaje_private?publickey=”;
    • MCP > Creator connection failing with Claude

      I'm trying to get claude to access any of my Zoho Creator apps and it keeps failing. I have enabled all tools for creator and ensured in claude settings that everything is authorised. Here is what claude says : Unfortunately, the error messages I'm receiving
    • Gantt Chart - Multiple Projects

      Hello, I have about 6 projects set up in Zoho and I am looking to see if it is possible to see all my projects on one gantt chart? Thanks Alex
    • milestone dependencies

      It would be exceptionally useful to be able to assign dependencies on milestone/tasks. For example, if within a project I have three milestones for creating three ads for publication, but each ad also requires the logo to be finished by the graphic designer (a separate milestone), it would be useful to have the start dates of the later items dependent on another prerequisite component. That way, not only would I not have to enter the logo creation as a separate task for each of the three milestones,
    • Next Page