Tip #2.1 Auto-updating shipment charges from multiple shipment records to sales orders in Zoho Inventory

Tip #2.1 Auto-updating shipment charges from multiple shipment records to sales orders in Zoho Inventory

Hello,

Hope you are doing good today.


Last week we saw how  we could convert our online sales orders into invoices automatically . This week, we will see how we can automate the process of adding up shipment charges from across multiple shipment orders and add the total shipment cost to a sales order or an invoice using custom functions. To make it easy on the reader, we have split this post into two parts. Part 1, or in other words this post will tell you how to apply this custom function to sales order. The subsequent post will tell you how you can do the same for your invoices.

How does this work?
Let's suppose you have a sales order containing 10 different items of varying quantities and availability. For some reason, you are unable to ship all of them together and so you ship them in 3 parts. Now, you have 3 shipment orders incurring different shipment charges. Normally, you'll have to obtain and add the shipment charges manually and then input the total number at the time of invoicing a customer.   

This can be quite tiresome. However, you can automate this using a custom function that captures shipment charges from every shipment associated with a particular sales order, adds them to arrive at a total shipment charge and updates this total to either your sales order or your invoice. 

Cool, are there any pre-requisites?
1) This automation will work only for manual shipments.
2) To update the total shipment charge to sales orders, all the items have to be shipped. 
3) You'll need to generate an auth token for your account. To do so, log in to your Zoho Account and then  click on this link before you begin setting up this custom function . Copy the auth token and keep it safe.

Alright, how do I set this up?

Method 1. Auto-updating total shipment charge to a sales order:

  • Open your Zoho Inventory.

  • Click on the Gear icon from the top-right corner, and select Automation from the drop-down.

  • Inside the Automation page, click on the drop-down button adjacent to +New Workflow button to select Custom Functions from the drop-down.

  • Give your workflow a name without any spaces between words.

  • Set Module as Sales Orders. 

  • Set the condition as: "When a Sales Order is created or edited".

  • Execute the Workflow "when any field is updated". and choose "Everytime".

  • Click on the advanced filter and set the condition as: "When Shipment Status is Shipped".

  • Finally, you are required to set the trigger point for this function as "Immediate".

  • Copy and paste the code segment below into the Deluge pane:

authtoken = "Copy and paste your auth token here"; 

shipamt = List();

salesorderID = salesorder.get("salesorder_id");

refnum = salesorder.get("reference_number");

info refnum;

salesorderdate = salesorder.get("date").toDate();

organizationID = organization.get("organization_id");

//replace authtoken and orgid

response = invokeurl

[

url :"https://inventory.zoho.com/api/v1/salesorders/" + salesorderID + "?authtoken=" + authtoken + "&organization_id=" + organizationID

type :GET

];

so = response.get("salesorder");

pkg = so.get("packages").toList();

sid = List();

for each pk in pkg

{

sid.add(pk.get("shipment_id"));

}

i = 0;

sumamt = 0;

for each index i in sid

{

resp = invokeurl

[

url :"https://inventory.zoho.com/api/v1/shipmentorders/" + sid.get(i) + "?authtoken=" + authtoken + "&organization_id=" + organizationID

type :GET

];

shipdet = resp.get("shipmentorder");

charges = shipdet.get("shipping_charge").toDecimal();

sumamt = sumamt + charges;

}

info sumamt;

bson = Map();

bson.put("salesorder_number",salesorder.get("salesorder_number"));

bson.put("customer_id",salesorder.get("customer_id"));

bson.put("shipping_charge",sumamt);

fin = zoho.inventory.updateRecord("SalesOrders",organizationID,salesorderID,bson);

info fin.toMap().get("message");

  • Make sure you copy and paste the auth token number that you had generated earlier to line 1 of this code fragment that says: authtoken = "Copy and paste your auth token here";

  • Hit Save to finish.

Now every time you have a Sales Order in Shipped status, the total shipment charge will be calculated and added to the sales order automatically. If you have any questions, email them to support@zoho-inventory.com

Please check out the part 2 of this post titled " Tip #2.2 Auto-updating shipment charges from multiple shipment records to invoices in Zoho Inventory" in our forums. Thanks!

Your everyday end user,
Ajay Aadhithya Chandrasekaran
Zoho Inventory

    Access your files securely from anywhere







                            Zoho Developer Community





                                                  Use cases

                                                  Make the most of Zoho Desk with the use cases.

                                                   
                                                    

                                                  eBooks

                                                  Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho Desk.

                                                   
                                                    

                                                  Videos

                                                  Watch comprehensive videos on features and other important topics that will help you master Zoho Desk.

                                                   
                                                    

                                                  Webinar

                                                  Sign up for our webinars and learn the Zoho Desk basics, from customization to automation and more

                                                   
                                                    
                                                  • Desk Community Learning Series


                                                  • Meetups


                                                  • Ask the Experts


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner






                                                            Manage your brands on social media



                                                                  Zoho TeamInbox Resources



                                                                      Zoho CRM Plus Resources

                                                                        Zoho Books Resources


                                                                          Zoho Subscriptions Resources

                                                                            Zoho Projects Resources


                                                                              Zoho Sprints Resources


                                                                                Qntrl Resources


                                                                                  Zoho Creator Resources



                                                                                      Zoho CRM Resources

                                                                                      • CRM Community Learning Series

                                                                                        CRM Community Learning Series


                                                                                      • Kaizen

                                                                                        Kaizen

                                                                                      • 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


                                                                                            Zoho Show Resources


                                                                                              Zoho Writer Writer

                                                                                              Get Started. Write Away!

                                                                                              Writer is a powerful online word processor, designed for collaborative work.

                                                                                                Zoho CRM コンテンツ








                                                                                                  Nederlandse Hulpbronnen


                                                                                                      ご検討中の方




                                                                                                            • Recent Topics

                                                                                                            • Adding Social Media Buttons to Basic Campaigns

                                                                                                              Hi, I'm quote new to using Zoho Campaigns and I can't work out how to add Social Media Buttons into my basic campaign? In MailChimp there's a button that brings the icons into your campaign for you. I've tried adding the social media icons as 'buttons' in Zoho but it's not looking great. Can anyone help? Thanks!
                                                                                                            • Hide Inactive Social Sign-In Providers from Login Screen

                                                                                                              Hello Zoho Team, We hope you are doing well. Currently, Zoho One allows admins to configure security policies and enable or disable Social Sign-In options for third-party providers such as Apple, Google, Microsoft, LinkedIn, Yahoo, Twitter, Facebook,
                                                                                                            • Zoho Cliq not working on airplanes

                                                                                                              Hi, My team and I have been having this constant issue of cliq not working when connected to an airplane's wifi. Is there a reason for this? We have tried on different Airlines and it doesn't work on any of them. We need assistance here since we are constantly
                                                                                                            • Settings Icon No Longer in ZOHO Desk?

                                                                                                              In ZOHO desk, there has been a gear icon for settings. as of yesterday, it is no longer there. I showed up briefly this morning but is gone again.  Anybody else experiecing this? 
                                                                                                            • Calls to accounts rather than leads or contacts?

                                                                                                              So..... We have a dilemma and I'm hoping someone has encountered this before and figured out a fix. We have just migrated to Zoho. It's great.....expect for how "Calls" are handled.... We are B2B. We do not use the leads module. A "Lead/Prospect" for
                                                                                                            • Adding branded signature to tickets reply

                                                                                                              Hi, i am unable to figure out how to add signatures with logo to tickets reply. please advice .
                                                                                                            • LESS_THAN_MIN_OCCURANCE - code 2945

                                                                                                              Hi I'm trying to post a customer record to creator API and getting this error message. So cryptic. Can someone please help? Thanks Varun
                                                                                                            • Sending emails from an outlook account

                                                                                                              Hi, I need to know if it's possible to send automatic emails from an Outlook account configured in Zoho CRM and, if so, how I can accomplish that. To give you some context, I set up a domain and created a function that generates PDF files to be sent later
                                                                                                            • [Free Webinar] AI Agents in Zoho Creator - Creator Tech Connect

                                                                                                              Hello Everyone! We welcome you all to the upcoming free webinar on the Creator Tech Connect Series. The Creator Tech Connect series is a free monthly webinar that runs for around 45 minutes. It comprises technical sessions in which we delve deep into
                                                                                                            • Can Zoho Flows repeat Actions more than once?

                                                                                                              I'm attempting to make an intentional Zoho Flow loop using the below layout. However, when "WithinLimit" condition is met, the program fails to execute the action "Get & Add Request Co..." again. Is this by design? Is Zoho Flows unable to repeat actions
                                                                                                            • How to update "Lead Status" to more than 100 records

                                                                                                              Hello Zoho CRM, How do I update "Lead Status" to more than 100 records at once? To give you a background, these leads were uploaded or Imported at once but the lead status record was incorrectly chosen. So since there was a way to quickly add records in the system no matter how many they are, we are also wondering if there is a quicker way to update these records to the correct "Lead Status". I hope our concern makes sense and that there will be a fix for it. All the best, Jonathan
                                                                                                            • Ship via Carrier Not Working Since Commerce Update

                                                                                                              Since the recent update to the Commerce platform, I can no longer use the ship via carrier function. It will take me to the address screen and let me verify them but when I go to save and move tot he next screen it will not do anything. This is happening
                                                                                                            • Zoho Marketing Automation 2.0 - Landing Page function not working

                                                                                                              Dear Zoho Team, I am working on implementing Zoho Marketing Automation 2.0, and am now looking into the section "Lead Generation". If I open the "Landing Pages" section, I immediately get an Error code: Error: internal error occurred. Can you help me
                                                                                                            • automations: Can I execute a step on a specific date?

                                                                                                              I have created a form in Zoho forms, and created a contacts list. I have also begun setting up an automation with the intention of sending the form to the contact list on a specific date every month (via email) for the entire year (essentially sending
                                                                                                            • Nimble enhancements to WhatsApp for Business integration in Zoho CRM: Enjoy context and clarity in business messaging

                                                                                                              Dear Customers, We hope you're well! WhatsApp for business is a renowned business messaging platform that takes your business closer to your customers; it gives your business the power of personalized outreach. Using the WhatsApp for Business integration
                                                                                                            • Image Upload Field | Zoho Canvas

                                                                                                              I'm working on making a custom view for one of our team's modules. It's an image upload field (Placement Photo) that would allow our sales reps to upload a picture of the house their working on. However, I don't see that field as a opinion when building
                                                                                                            • Zoho Expense - The ability to add detail to a Trip during booking

                                                                                                              As an admin, I would like the ability to add more detail to the approved Trips. At present a requestor can add flights, accommodation details and suggest their preferences. It would be great if the exact details of the trip could be added either by the
                                                                                                            • Simplified Call Logging

                                                                                                              Our organization would like to start logging calls in our CRM; however, with 13 fields that can't be removed, our team is finding it extremely cumbersome. For our use case, we only need to record that a call happened theirfor would only need the following
                                                                                                            • Signup forms behaviour : Same email & multiple submissions

                                                                                                              My use case is that I have a signup form (FormA) that I use in several places on my website, with a hidden field so I can see where the contact has been made from. I also have a couple of other signup forms (FormB and FormC) that slight differences. All
                                                                                                            • Adding Folders in Android App

                                                                                                              Is it possible to create a new email folder within the Zoho Mail Android app?  Or can this only be done from the desktop version of Zoho Mail? Cheers!
                                                                                                            • Schedule Exports for Regular Project Updates

                                                                                                              Tracking project data often means exporting data at regular intervals. Instead of manually exporting data every time, users can schedule exports for Phases, Tasks, and Tasks in Zoho Projects. These exports can be set to run once, daily, weekly, or monthly
                                                                                                            • Question about custom fields using Pivot Tables.

                                                                                                              I have created a pivot table showing annual revenue of a client and how much payment that client is paying my company. Is there a way using pivot table to add an additional field that subtracts those to fields / shows me a percentage of that difference?
                                                                                                            • Request for Light/Dark Mode

                                                                                                              Would love the ability to switch between Light and Dark mode similar to Zoho CRM. https://help.zoho.com/portal/en/community/topic/introducing-dark-mode-light-mode-a-new-look-for-your-crm
                                                                                                            • Signature field is showing black

                                                                                                              Hello, When customer signed the service form, it is showing as below picture Phone model: iPhone 16 Pro We tried delete and install application, but it not solved. This has on phone of a few person. There is any advice to solve this?
                                                                                                            • Range names in Zoho Sheet are BROKEN!

                                                                                                              Hi - you've pushed an update that has broken range names. A previously working spreadsheet now returns errors because the range names are not updating the values correctly. I've shared a video with the support desk to illustrate the problem. This spreadsheet
                                                                                                            • Journey Email - Ignored Contacts

                                                                                                              I have a journey setup which simply sends a string of emails over time. For some reason I am getting large amounts of the contacts who enter the first email being ignored and I can't find anywhere in reports or audit logs why these contacts are not
                                                                                                            • Involved account types are not applicable when create journals

                                                                                                              { "journal_date": "2016-01-31", "reference_number": "20160131", "notes": "SimplePay Payroll", "line_items": [{ "account_id": "538624000000035003", "description": "Net Pay", "amount": 26690.09, "debit_or_credit": "credit" }, { "account_id": "538624000000000403", "description": "Gross", "amount": 32000, "debit_or_credit": "debit" }, { "account_id": "538624000000000427", "description": "CPP", "amount": 1295.64, "debit_or_credit": "debit" }, { "account_id": "538624000000000376", "description":
                                                                                                            • Zoho Books - Include Payment Terms as a Custom View filter

                                                                                                              It would be great if you could created a custom view based on Payment Terms. This would be really handy for seeing a list of customers who have credit terms. A workaround is not required. I could do something with a creditor checkbox, but it would be
                                                                                                            • How to update changed purchase account of item in invoice

                                                                                                              I have selected the wrong purchase account for various articles and created invoices. I had to adjust the purchase account in the article afterwards, but the old purchase account is still posted in the transaction-journal of the invoice. To adjust the
                                                                                                            • Help - Zoho CRM notification on mobile (IOS/Android)

                                                                                                              Hello Community! Can I get the IOS/Andoid CRM app to notify me of events, calls, etc. due as I can with MANY other apps?   I am running the free Zoho I would like this to be native to the Zoho CRM app. I do not want to write a sep. mobile app
                                                                                                            • Zoho Books Idea - Include another field in Bank Details for Address

                                                                                                              Hi Books team, Currently use the Description field in the Bank Details to store the bank's address. This works fine but it would be great if you could add another field for Bank Address, so that other notes about the bank account could be stored in the
                                                                                                            • Reverse payment on accidentally closed invoice.

                                                                                                              An invoice was closed accidentally with the full payment added. However, only partial payment was paid. How can I reopen the invoice and reverse this to update it to show partial payment?
                                                                                                            • a question about the COQL API v8

                                                                                                              When I specify eight or more values in a WHERE IN clause and execute it, an error occurs. Is there a limit to the number of values that can be specified in a WHERE IN clause? ↓Error select * FROM Vendors WHERE (id in (1, 2, 3, 4, 5, 6, 7, 8, 9)) ↓Success
                                                                                                            • Zoho Books Idea - Bank Details Button on Banking

                                                                                                              Hi Books team, Sometimes I'm asked to share bank details with a customer or a colleague. So I go to the Banking Module, find the correct bank account, click Setting > Edit, then copy and paste the bank details. Wouldn't it be great if there was a button
                                                                                                            • JS SDK 8.0 – TypeError: Cannot read properties of undefined (reading 'getCacheStore') with sample code

                                                                                                              Hello Zoho Support Team, I’m integrating the Zoho CRM JavaScript SDK v8.0 and I’m getting the error below when running your official sample. I tested directly from: https://github.com/zoho/zohocrm-javascript-sdk-8.0/blob/main/samples/create_records_sample/create_records.js
                                                                                                            • Function #55: Convert multiple quotes to single SO using Custom Button

                                                                                                              Hello everyone, and welcome back to our series! In Zoho Books, after a quote is accepted by your customer, it can be converted into a sales order or an invoice. Often, a customer might have multiple quotes, and for easier billing or upon the customer's
                                                                                                            • Zoho One - Syncing Merchants and Vendors Between Zoho Expense and Zoho Books

                                                                                                              Hi, I'm exploring the features of Zoho One under the trial subscription and have encountered an issue with syncing Merchant information between Zoho Expense and Zoho Books. While utilizing Zoho Expense to capture receipts, I noticed that when I submit
                                                                                                            • More controls for User Fields in CRM

                                                                                                              Dear All, We are here with a minor but crucial enhancement to the user fields—now set accessibility permissions to the records for user field. User field allows you to extend co-ownership of records to your peers. You can collaborate with them for certain
                                                                                                            • Rich Text For Notes in Zoho CRM

                                                                                                              Hello everyone, As you know, notes are essential for recording information and ensuring smooth communication across your records. With our latest update, you can now use Rich Text formatting to organize and structure your notes more efficiently. By using
                                                                                                            • Time based workflow without edit/action

                                                                                                              Hello I need help solving this problem if possible. We have Deals come into the CRM via Live Transfer which have the field properties: Stage = New Channel = Inbound Some of them don't get answered so we want these to automatically go into our Outbound
                                                                                                            • Next Page