ERPNext Create Stock Entry Node icon

ERPNext Create Stock Entry Node

Creates a Stock Entry in ERPNext

Overview

This node creates a Stock Entry record in an ERPNext system. It is designed to take JSON data representing the details of a stock entry and send it to ERPNext via its API, thereby automating inventory management tasks such as recording stock movements or adjustments.

Common scenarios where this node is beneficial include:

  • Automating stock updates when goods are received or dispatched.
  • Integrating external systems with ERPNext for real-time inventory synchronization.
  • Streamlining warehouse operations by programmatically creating stock entries based on business logic.

For example, a user could feed this node with JSON data describing a new stock receipt, and the node will create the corresponding stock entry in ERPNext without manual intervention.

Properties

Name Meaning
Stock Entry Data A JSON object containing the detailed information of the stock entry to be created. This must conform to the expected structure required by ERPNext's stock entry API.

Output

The node outputs an array of JSON objects, each corresponding to an input item processed:

  • On success, the output JSON contains a stock_entry field holding the response from ERPNext after creating the stock entry.
  • If the input item's status is missing or marked as "not available", the node skips processing that item and outputs a JSON indicating the skip with a message.
  • On failure (e.g., API errors), if the node is configured to continue on failure, it outputs a JSON with success: false and an error message; otherwise, it throws an error stopping execution.

No binary data output is produced by this node.

Example output JSON on success:

{
  "stock_entry": {
    /* ERPNext API response for the created stock entry */
  }
}

Example output JSON on skipped item:

{
  "success": false,
  "message": "Skipped because status is not available"
}

Example output JSON on error (if continuing on fail):

{
  "success": false,
  "error": "Error message here"
}

Dependencies

  • Requires access to an ERPNext instance with API enabled.
  • Needs credentials including the ERPNext domain URL, an API key, and an API secret for authentication.
  • Uses an internal utility function to post the stock entry data to ERPNext's API.
  • The node expects the ERPNext API to accept basic authentication using the API key and secret.

Troubleshooting

  • Skipped items due to missing or invalid status: The node checks for a status field in the input JSON and skips processing if it is missing or set to "not available". Ensure your input data includes a valid status field.
  • Authentication errors: Verify that the provided ERPNext domain, API key, and secret are correct and have sufficient permissions to create stock entries.
  • API errors: If the ERPNext API returns errors (e.g., validation failures), these will be surfaced in the output if "continue on fail" is enabled or cause the node to stop otherwise. Check the error messages for details on what went wrong.
  • Malformed JSON input: The Stock Entry Data property must be a valid JSON object matching ERPNext's expected schema. Invalid JSON or missing required fields can cause API errors.

Links and References

Discussion