Order Flow
Last updated
Was this helpful?
Last updated
Was this helpful?
The Order Flow facilitates the transfer of order data from Omnitron to ERP systems. The flow retrieves a list of orders that have not yet been sent to the ERP and processes them accordingly. The flow operates only in an inbound mode.
Inbound order flow means that the flow triggers itself at specific intervals set by the user, such as once every minute, every 1 hour, every day at midnight, every 5th day of a month, etc., to fetch unsent orders from Omnitron and send them to the ERP system. If the transfer to the ERP is successful, the order is marked as "is sent" in Omnitron, ensuring clear tracking and synchronization of orders between the systems.
This process ensures reliable and efficient communication between Omnitron and ERP, maintaining accurate and up-to-date order information across the system.
Inbound Flow: Indicates that the flow will read data from the Omnitron. A cron schedule is set up to ensure it runs, for example, every 5 minutes.
Login Step: Handles logging into Omnitron and (if configured) the ERP system. If an error occurs during this step, the details are logged.
Read Data From Omnitron Step: Order queries are made to the Omnitron system to find orders where Omnitron “is_send” value is false and not canceled matching the channel filter.
Query Check Order Step: For each order, an ERP query is made using order number to see if the order is already written to the ERP, if the execution skips to Check Response Script Step.
Script Step (Optional): Transformation operations on each order object is performed using Python, if required.
Mapping Step (Optional): Transformation operations on each order object is performed using the Jolt Transform library. Further details can be found at the website.
Write Data to ERP Step: The transformed order information is sent to ERP.
Check Response Script Step: The Write Data to ERP Step input data and ERP response for each order is given to python script one by one to check if ERP requests are successful and prepare mapping data for Write Data to Omnitron step.
Write Data to Omnitron Step: For each order, order is marked as “is send”, order and order item mappings are done based on Check Response Script output.
Post Script Step: Runs after Write Data to Omnitron Step if Check Response Script step is successful or after Write Data To ERP step if it fails and Post Script is configured to run on failure.
Omnitron API Settings
This card requires only the Omnitron Channel parameter to be specified for filtering orders based on designated sales channels.
Omnitron Channel: The Omnitron Channel parameter is used to filter orders based on specific Omnitron channels. This input requires a comma-separated list of channel IDs. Channel IDs can be found in Omnitron by navigating to Settings > Sales Channels. The channel ID is visible in the URL for each channel on the Sales Channels page.
The Omnitron query flow retrieves order data based on the specified channel filter. This process is for informational purposes, as the actual order flow is managed by the system itself. The query operates using the following path:
Steps in the Flow
Query Orders: Orders are retrieved from Omnitron that are neither canceled nor already sent to the ERP.
Retrieve Order Details: For each order returned by the query, the following steps are performed:
An order detail request is made using: /api/v1/orders_integration/<order_pk>/detailed_integration
Order items are queried using: /api/v1/order_items/?order_id=<order_pk>&limit=99999
For each order item, detailed data is retrieved via: /api/v1/order_items/<order_item_pk>/detailed_integration
Discount items are queried similarly via: /api/v1/discount_items/?order_id=<order_pk>&limit=99999
For each discount item, detailed data is retrieved via: /api/v1/discount_items/<discount_item_pk>/detailed_integration
Build Detailed Order Data: Both the order items and discount items are appended to the detailed order data structure.
Each order is queried on the ERP system to see if it is already sent. If the order is already sent, execution skips to the “Check Response Script” step for the related order with order data from Omnitron and ERP response.
Custom Response Path: This is used to point where order information (if exists) should be when a query response is successful, if the path result is not empty or equal to Custom Response Path Value the query result will be considered to be found.
Custom Response Path Value: Used with Custom Response Path, if the path result is equal to the input value, the query is considered to be not found and the execution will continue to next steps as usual.
Failure Status Codes: A list of comma separated HTTP status codes. If an ERP query gets a response with status codes written in this input execution will end with a failure without continuing. This input is useful to find if an ERP can not respond correctly at the moment and it is impossible to know if order already exists or not in the system.
Order Not Found Codes: A list of comma separated HTTP status codes. If an ERP query gets a response with status codes written in this input, flow will continue to the next steps normally. This is useful if an ERP system responds with success codes with a body like 201 even if the order does not exist in the system.
This is a base script that can be updated to enable script functionality within the process step.
Scripts can read incoming data from the inputStream
, where the variable input_text
contains a JSON string. This string should be parsed using Python's json
library. Any outgoing data is written using the outputStream.write()
method after converting the relevant Python object back into a JSON string.
Additionally, the script allows for the use of attributes, which provide supplementary information tied to the current execution process. These attributes can be freely accessed or modified throughout the script. For example, the get_attribute()
function is used to read attribute values, while the session.putAttribute()
method is used to write new string attribute values. Each attribute consists of a key-value pair, where the key
uniquely identifies the attribute, and the value
can be referenced in subsequent steps. On Order flows, order_exists
attribute can be set as “true” (string true) to set order as already exists in the script step, this is useful if order can not be queried using the Query Check Order step.
Attributes with keys starting with the prefix log.
will be automatically logged at the end of the execution if a log file is generated, ensuring that important information is captured and available for later review.
Example Script:
Script Testing: The ERP response is placed in the input field, and the script's result along with the written attributes can be viewed in the result field. When the test script is run, attributes like log.script.error
will appear under the "attributes" section in the result panel and should be referenced if any exceptions occur during execution. The script's output content will be found under the result_data
value.
The + Add Attributes button can be used to simulate incoming, readable, attributes for the script. This feature is useful when an attribute value is read and used in the script. Note that attributes added through the button are only for testing purposes and will not be saved in the flow information—they will be removed when the page is refreshed.
Example Input: Example input can be constructed using the endpoints written in Read Data From Omnitron or a data similar to that can be retrieved from Omnitron using /api/v1/orders_integration/detailed/?limit=1&number=<order_number>
endpoint. The input of the script step will be an order object of the retrieved order array, script step is expected to run with only one order each time.
Mapping Testing:
The response from the script or the response of the Omnitron request for order data, if the script step is not used, is placed in the input field and the result of the mapping is viewed in the result field.
The finalized data from Script and/or Mapping steps is sent to ERP using configuration entered in this step. A successful request must respond with 2xx HTTP status codes.
ERP Order Create API URL: ERP URL for writing the orders to.
ERP Order Create API Method: The HTTP method used while creating the order on ERP.
The response from the Write Data to ERP Step is merged with the request body and passed to the Check Response Script Step. This step is very similar to the Script Card (Optional) which can be used to learn about the details of scripting in Integrator.
Check Response Script comes with a default script where the mapping values are gathered from request data assuming request data has a similar structure to Omnitron data. In the case that request data changed from Omnitron data and can not be used the same way, request and response data should be used to fill out the following structure same way the default script does:
This script runs with the “request_data” and “response_data” from the ERP write request after the "Write Data to Omnitron" step, if the "Write Data to ERP" step is successful. If the step fails and “Run On Failed Order” is set to true, the script will run directly after the "Write Data to ERP" step.
This script is optional, and its output is not used. It can be used for additional actions after the order is updated in Omnitron, such as updating CRM services or performing other tasks.
Domain URL: Omnitron's domain URL, Example: .
Query URL: The ERP URL to query order from, order number is provided to this input using ${_order.number}
variable, Integrator will not modify the URL before query a valid query should be provided in the input for querying the order using order number. Ex:
Details can be found at the website. The flow expects the following output to be an order request object for each order, as the input will also be the data of one order. Entegrator uses the output of this mapping step as the body of the ERP request, therefore there is no expected data structure; the output structure of the mapping step is fully dependent on ERP requirements.