Full Stock Flow
Last updated
Was this helpful?
Last updated
Was this helpful?
The FullStock flow ensures the synchronization of all product stock levels between ERP systems and Omnitron by fetching and comparing stock data. This flow operates exclusively in an inbound mode and triggers itself once daily at a fixed time, which cannot be altered by the user and the flow can not be manually triggered. During each execution, it retrieves all stock levels from the ERP system, compares them to the existing stock data in Omnitron, and identifies discrepancies. For products with stock differences, the flow automatically triggers the corresponding stock flow to fetch and update the individual product stock levels. By systematically identifying and updating mismatched stock data, the Full Stock flow ensures accurate and consistent inventory information across the systems.
Inbound Flow: Indicates that the flow will read data from the ERP system. The flow is exclusively inbound, it will always run once a day at the set time that can’t be altered by the user.
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 ERP Step: Stock queries are made from the ERP system.
Script Step (Optional): Transformation operations on the data are performed using Python, if required.
Mapping Step (Optional): Transformation operations on the data are performed using the Jolt Transform library. Further details can be found at the documentation and website.
Compare Stocks: This step identifies discrepancies between the stocks retrieved from the ERP system and those stored in Omnitron. It triggers the corresponding stock flow for each product with a stock difference to ensure accurate synchronization.
Omnitron API Settings:
Timezone Settings: Timezone used for date-based queries from ERP, this value is used with inbound task requests to modify modified_date__gt
value for a specific timezone. The date time format is following: yyyy-MM-dd'T'HH:mm:ss.SSSSSS
, ex: 2024-12-31T13:30:59.000001
Add Extra Headers as Dict Format: During the stock query from ERP, additional headers to be sent.
Stock List Key: Key used as a parameter during queries from ERP.
Extra Params: Additional parameters used when ERP request is made, it must be a valid dict if a GET
request is made which will be used to send query parameters in the URL or it can be used on a POST
request in which the extra params value will be used to be sent in request body.
Endpoint URL: URL for reading data from the ERP system.
Dynamic URL Usage:
HTTP Method: GET
or POST
Pagination:
Offset pagination is a method where a fixed number of items are retrieved from a data source in each request, starting from a specified offset. This offset indicates the position from which to begin fetching data.
Seek pagination relies on a unique identifier or a specific value to retrieve subsequent sets of data. Instead of using offsets, it uses a marker or token indicating where the previous set of data ended.
Next field pagination includes a "next" field or token in each server response that points to the next page of data.
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.
Attributes whose keys begin with the prefix log.
will be automatically logged at the end of the execution if a log file is generated, ensuring important information is recorded and can be reviewed later.
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 Mapping:
Expected Output:
Mapping Testing: The response from the script is placed in the input field, and the result of the mapping is viewed in the result field.
Stock Flow:
This is a dropdown field that is used for selecting related stock flow for current Full Stock flow. Using this dropdown it is possible to select one of the stock flows of the project, for each product with a stock difference this flow will be triggered to query the products from erp one by one.
Comparison Settings:
This setting is used for comparing products between the ERP and Omnitron. An SQL like language is used for comparing the products, where a default query is provided when the flow is first created.
Omnitron Stock List ID: This refers to the ID associated with the stock list in Omnitron, which needs to be updated. To retrieve this information, navigate to Products and Catalogs, then to Stock List. Open the stock list page, and the ID will be visible in the last digits of the URL. For example, in the URL: , the stock list ID is "1". This ID is also used in the "Fetch Missing" task to identify missing SKUs in the stock list.
Domain URL: Omnitron's domain URL, Example: .
Dynamic URLs are used when the url structure, path changes based on different conditions or if the URL doesn’t fit a standard REST API structure. In the example below, the URL changes if the request is going to be a “date” based query or “sku” based query and at the same time the API requires the ERP token to be in the URL itself. Using language it is possible to change the request URL in the run time based on conditions and expressions written in the URL field.
For more information about script card, please refer to the .
Details can be found at the website. Because this is the last step the input data can be transformed, the flow expects the following output at the end of this step to work correctly.