Tip #6.2 Notify vendors of the remaining goods you are yet to receive.

Tip #6.2 Notify vendors of the remaining goods you are yet to receive.

Hello again,


In part 1, we saw how we could notify vendors of successful deliveries made by them. Here, we will see how we can notify vendors of purchased items that we are yet to receive, whenever these vendors make partial deliveries.

How does it work?

Let's suppose you order items A (20 pcs) and B (35 pcs) from a vendor. Now the vendor delivers only 15 pcs of A and 7 pcs of B to your warehouse. When you record a purchase receive for these items, the custom function will automatically send out an email notification to the vendor telling them that they are yet to deliver 5 pcs of A and 28 pcs of B. Similarly, the vendor will be informed of all "yet to arrive items" until all of them have been received by you. 

Setting up the custom function:

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 to this workflow rule and make sure that there are no spaces between words.

  • Select Purchase 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 Purchase Order is" "Created or Edited".

  • Function shall be executed "When any field is updated".

  • And set the frequency of execution to "Everytime".

  • Click on the Apply Advanced Filter option.

  • The trigger to execute this function shall be: "When" the "Purchase Receive Status" "is" "Partially Received".

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

purchaseorderID = purchaseorder.get("purchaseorder_id");

purchaseorderdate = purchaseorder.get("date").toDate();
organizationID = organization.get("organization_id");
ponum = purchaseorder.get("purchaseorder_number");
authtoken = "XXXXXXXXXXXXXXXXXXXXXXX";
vendorID = purchaseorder.get("vendor_id");
str = "<u>YET TO RECEIVE FOLLOWING ITEMS</u>";
res = invokeurl
[
url :"https://inventory.zoho.com/api/v1/purchasereceives/editpage?purchaseorder_id=" + purchaseorderID + "&organization_id=" + organizationID + "&authtoken=" + authtoken
type :GET
];
po = res.get("purchaseorder");
//info po;
prdet = po.get("line_items").toList();
//info prdet;
i = 1;
lineitems = purchaseorder.get("line_items");
for each det in prdet
{
if(det.get("quantity_ordered").toDecimal() != det.get("quantity_received").toDecimal())
{
iid = det.get("item_id");
for each line in lineitems
{
if(iid == line.get("item_id"))
{
sku = line.get("sku");
prate = line.get("rate");
break;
}
}
info sku;
info prate;
str = str + "<br>";
str = str + "<br>";
str = str + i + ".";
str = str + " " + det.get("name");
str = str + " " + " " + "[ SKU : " + sku + " ] ";
str = str + "-";
str = str + " " + " ";
tbr = det.get("quantity_ordered").toDecimal() - det.get("quantity_received").toDecimal();
str = str + " Quantity : " + tbr.toString();
i = i + 1;
}
}
//info str;
if(str.contains("Quantity"))
{
// info vendorID;
resp = invokeurl
[
url :"https://inventory.zoho.com/api/v1/contacts/" + vendorID + "?authtoken=" + authtoken + "&organization_id=" + organizationID
type :GET
];
cont = resp.get("contact");
contactdet = cont.get("contact_persons").toList();
//info contactdet;
for each deta in contactdet
{
if(deta.get("is_primary_contact").toString().equalsIgnoreCase("true"))
{
vendoremail = deta.get("email").toString();
break;
}
}
info vendoremail;
sendmail
[
from :zoho.adminuserid
to : vendoremail //EMAIL ID
subject :"REGARDING PURCHASE ITEMS FOR " + ponum
message :str
]
}
else
{
info "all received";
}
  • Don't forget to navigate to the line containing the authtoken within the code snippet and replace the XXXXXXXXXXX with the auth token number that you had generated in the first step.

  • To send this notification to one or more dedicated email addresses instead of the vendor, you can do that by navigating to this line:

    • to : vendoremail //EMAIL ID

    • And replace vendoremail with one or more email addresses of your choice like "abc@xyz.com, def@xyz.com"

  • Hit Save to finish.


Hope this helps in reducing your product wait time and improves your relationship with your vendors.

Until next time.

Your everyday end user,
Ajay Aadhithya Chandrasekaran
Zoho Inventory