Purchase order and a Revolut draft payment when Zoho inventory falls

Create a purchase order and a Revolut draft payment when Zoho inventory falls below certain level

8/10/20248 min read

To automate the creation of a purchase order and a Revolut draft payment when inventory levels fall below a certain threshold in Zoho Inventory, you can use Make.com (Integromat). This process involves monitoring your inventory levels in Zoho Inventory, triggering a purchase order when the stock falls below a predefined level, and then setting up a draft payment in Revolut.

Steps to Automate the Process Using Make.com

1. Set Up Zoho Inventory and Define the Threshold

  • Zoho Inventory: Ensure your inventory levels are correctly tracked in Zoho Inventory. Each product should have a minimum stock level or reorder point defined.

2. Create a Scenario in Make.com

  • Log in to Make.com: Sign in to your Make.com account and click on "Create a new scenario."

3. Add Zoho Inventory Module

  • Search and Select Zoho Inventory: Add a Zoho Inventory module by searching for "Zoho Inventory" in the module search.

  • Choose Action: Select the "Watch Inventory Levels" action or a similar trigger that monitors when inventory falls below a specified threshold.

  • Set Parameters: Configure the module to watch your inventory levels, specifying the product(s) and the threshold (minimum stock level).

4. Add Zoho Inventory – Create Purchase Order Module

  • Add a Purchase Order Module: After the inventory check, add another Zoho Inventory module.

  • Action: Choose "Create a Purchase Order".

  • Configure Purchase Order Details:

    • Map the necessary fields such as the supplier, items, quantity, etc.

    • Ensure the order is triggered only when the inventory falls below the defined level.

5. Add Revolut Business Module

  • Search for Revolut: Add a Revolut Business module.

  • Action: Choose "Create a Payment Draft".

  • Map Payment Details:

    • Map the payment details from the purchase order to the draft payment in Revolut.

    • Include necessary fields like the supplier, amount, currency, and any relevant payment references.

6. Set Up Conditional Logic (Optional)

  • Router Module: Add a router to set up conditional logic if you need to handle different products or suppliers differently.

  • Filters: Set filters to ensure that actions are only triggered when specific conditions are met (e.g., different actions for different inventory levels or suppliers).

7. Test the Scenario

  • Run Test: Manually test the scenario by simulating an inventory drop in Zoho Inventory.

  • Verify: Ensure that a purchase order is created in Zoho Inventory and a draft payment is set up in Revolut.

8. Schedule and Activate the Scenario

  • Schedule the Scenario: Set the scenario to run periodically (e.g., every hour, daily) to keep track of inventory levels.

  • Activate: Turn on the scenario to start the automation.

Summary

By following these steps in Make.com, you can automate the entire process of creating a purchase order in Zoho Inventory and generating a draft payment in Revolut when stock levels fall below a certain threshold. This integration helps ensure that you can reorder inventory and manage payments efficiently without manual intervention.

Enhanced Workflow with a Script Component

Let's say you want to add some custom logic to determine the reorder quantity dynamically based on recent sales data or to perform some calculations before creating the purchase order and draft payment.

Scenario Setup with Script Component:

  1. Add Zoho Inventory Module (Monitor Inventory Levels):

    • This module checks when inventory levels fall below the specified threshold.

  2. Add a JavaScript Module (Custom Logic):

    • Search for "JavaScript" Module in Make.com.

    • Insert this module right after checking the inventory levels but before creating the purchase order.

    Example Script:

    Here’s an example script that dynamically calculates the reorder quantity based on recent sales data:

// Sample input: recentSales is an array of sales quantities over the last X days

const recentSales = [5, 10, 8, 7, 12]; // Replace with actual sales data fetched from another module

// Calculate the average sales over the period

const averageSales = recentSales.reduce((total, sales) => total + sales, 0) / recentSales.length;

// Reorder quantity is set to 2 times the average sales, ensuring enough stock until the next reorder

const reorderQuantity = Math.ceil(averageSales * 2);

// Pass the reorderQuantity to the next module

return {

reorderQuantity: reorderQuantity

};

  • Inputs: You could fetch recent sales data from Zoho Inventory using another module or have it passed in as input to this script.

  • Output: The script outputs the calculated reorderQuantity, which you can then pass to the purchase order creation step.

  1. Add Zoho Inventory – Create Purchase Order Module:

    • Configure Purchase Order: Use the reorderQuantity from the JavaScript module to set the quantity in the purchase order dynamically.

  2. Add Revolut Business Module (Create Draft Payment):

    • Create a payment draft in Revolut using the calculated order details.

  3. Additional Customizations:

    • Conditional Logic: Add conditions based on product type, supplier, or other factors before the script to adjust the logic accordingly.

  4. Test and Activate:

    • Run tests to ensure the custom logic in the script works as expected and that the entire workflow operates smoothly.

Use Case Examples for the Script Component

  • Dynamic Reordering: Instead of a fixed reorder quantity, the script dynamically adjusts the quantity based on recent sales trends or other criteria.

  • Advanced Calculations: Perform complex financial calculations before generating the draft payment, ensuring the correct amount is transferred.

  • Custom Logic: Implement custom business rules that require programming logic, such as discount calculations, tiered pricing, or supplier-specific conditions.

By incorporating a script component, you add a layer of customization and sophistication to your workflow that goes beyond basic automation. This allows you to tailor the process to specific business needs and scenarios, making your automation smarter and more adaptable.

we can add additional components that enhance data management, error handling, notifications, and reporting. Below are some advanced functional components you can add to your scenario in Make.com:

Before proceeding with creating a purchase order or draft payment, you can add a data validation step to ensure that the data being used is accurate and complete.

  • JavaScript Module for Data Validation:

    • Add a JavaScript module to check if all necessary data (like supplier information, product ID, etc.) is present and valid.

      Example Script:

    const supplier = inputData.supplier;

    const productId = inputData.productId;

    const reorderQuantity = inputData.reorderQuantity;

    if (!supplier || !productId || reorderQuantity <= 0) {

    throw new Error("Invalid data: Supplier, Product ID, or Reorder Quantity is missing or incorrect.");

    }

    return {

    isValid: true

    };

    If the data is invalid, the script can throw an error, halting the process before any orders are created.

2. Error Handling and Retry Logic

Sometimes API calls can fail due to temporary issues like network errors. Adding error handling and retry logic can make your automation more reliable.

  • Error Handler:

    • Add an error handler module that retries the operation if an error occurs.

    • You can set up a retry strategy to attempt the failed operation a few times before logging the error or sending an alert.

3. Logging and Reporting

Keeping a log of all actions performed by the automation is critical for tracking and troubleshooting.

  • Google Sheets Module for Logging:

    • Add a Google Sheets module where every action taken by the scenario is logged, including details like the product ID, reorder quantity, supplier, and any errors encountered.

    • Example Log:

      • Date/Time

      • Product ID

      • Reorder Quantity

      • Supplier

      • Status (e.g., "Order Created", "Error", "Payment Drafted")

4. Notification Component

To keep you or your team informed, you can add notification steps that alert you when certain actions are taken or when errors occur.

  • Email Module:

    • Add an email module to send notifications when a purchase order is created, a payment draft is made, or an error is encountered.

    • Customize the email content to include relevant details like the product, supplier, and any issues that need attention.

  • Slack or Microsoft Teams Module:

    • If your team uses Slack or Microsoft Teams, add a module to send real-time notifications to a specific channel whenever an important action occurs or if something goes wrong.

5. Conditional Logic with a Router Component

To handle different products or suppliers differently, use conditional logic.

  • Router Module:

    • Use the Router module to split the scenario into different paths based on conditions (e.g., supplier, product type, stock levels).

    • Each path can have its own set of actions, such as creating different types of purchase orders or sending notifications to different people.

6. Backup and Redundancy

To ensure data integrity and have a backup plan in case something goes wrong:

  • Google Drive or Dropbox Module:

    • Add a module to save a backup copy of important data or files to Google Drive or Dropbox. For instance, after creating a purchase order, save a copy of the order details.

    • This ensures that you have a backup even if something fails later in the process.

7. Timed Triggers and Scheduling

Instead of running your scenario only when inventory falls below a threshold, you can add scheduled checks:

  • Schedule Module:

    • Use the Schedule module to trigger the inventory check at regular intervals (e.g., daily or weekly), ensuring that stock levels are always up to date and orders are created proactively.

8. External API Calls

If you need to fetch or send data to a service that isn’t natively supported by Make.com, you can add an HTTP module to interact with external APIs.

  • HTTP Module:

    • Use the HTTP module to make GET or POST requests to an external API.

    • This can be useful for pulling additional data required for the purchase order or sending order details to another service.

By integrating these additional components, you enhance your scenario with data validation, error handling, logging, notifications, conditional logic, backup, and redundancy. These enhancements ensure that your automation is not only functional but also resilient, adaptable, and transparent, providing a comprehensive solution to managing inventory and payments efficiently.

you can add a JavaScript module to dynamically select the best supplier based on factors like price, delivery time, or stock availability. This script will choose the supplier based on the predefined criteria and pass the selected supplier information to the subsequent steps in your Make.com scenario.

Dynamic Supplier Selection Script

1. Scenario Setup with Supplier Data Retrieval

Before the script, you'll need to retrieve the relevant supplier data (price, delivery time, stock availability, etc.) from Zoho Inventory or an external API.

  • Add a Module: Use the Zoho Inventory or an HTTP module to fetch supplier data. This data might include:

    • supplierName

    • pricePerUnit

    • deliveryTime (in days)

    • stockAvailability

2. JavaScript Module for Dynamic Supplier Selection

After retrieving the supplier data, insert a JavaScript module to process and select the best supplier:

// Example supplier data retrieved from Zoho Inventory or an external API

const suppliers = [

{

name: "Supplier A",

pricePerUnit: 10.5,

deliveryTime: 5, // in days

stockAvailability: 100

},

{

name: "Supplier B",

pricePerUnit: 9.8,

deliveryTime: 7,

stockAvailability: 200

},

{

name: "Supplier C",

pricePerUnit: 11.0,

deliveryTime: 3,

stockAvailability: 50

}

];

// Define your criteria weights

const priceWeight = 0.5;

const deliveryTimeWeight = 0.3;

const stockAvailabilityWeight = 0.2;

// Function to calculate the score for each supplier

function calculateSupplierScore(supplier) {

return (supplier.pricePerUnit * priceWeight) +

(supplier.deliveryTime * deliveryTimeWeight) +

(supplier.stockAvailability * stockAvailabilityWeight);

}

// Find the supplier with the lowest score (best choice)

let bestSupplier = suppliers[0];

let bestScore = calculateSupplierScore(suppliers[0]);

suppliers.forEach(supplier => {

const score = calculateSupplierScore(supplier);

if (score < bestScore) {

bestSupplier = supplier;

bestScore = score;

}

});

// Return the best supplier's details to be used in the next step

return {

selectedSupplier: bestSupplier.name,

selectedPrice: bestSupplier.pricePerUnit,

selectedDeliveryTime: bestSupplier.deliveryTime,

selectedStock: bestSupplier.stockAvailability

};

3. Integration with the Purchase Order Creation

  • Use Output in the Purchase Order Module:

    • The output from this script (selectedSupplier, selectedPrice, selectedDeliveryTime, selectedStock) can be passed to the Zoho Inventory module to create the purchase order with the selected supplier.

  • Example Mapping:

    • Supplier: Map selectedSupplier to the supplier field in your purchase order creation module.

    • Price: Use selectedPrice to fill in the unit price in the purchase order.

    • Delivery Time: You can also use selectedDeliveryTime to calculate expected delivery dates or to set delivery conditions in the order.

    • Stock Availability: This can be used to ensure the supplier can fulfill the order within the required timeframe.

Summary

This script allows you to automatically select the most appropriate supplier based on multiple criteria, such as price, delivery time, and stock availability. By integrating this script into your Make.com scenario, you can ensure that your inventory is sourced from the best possible supplier dynamically, without manual intervention. This enhances the robustness and efficiency of your automation, particularly in environments where multiple suppliers are involved.