# Order Status Code

## Script Manifest File (YML) <a href="#script-manifest-file-yml" id="script-manifest-file-yml"></a>

### Upstream Transformation Dependencies <a href="#upstream-transformation-dependencies" id="upstream-transformation-dependencies"></a>

{% hint style="danger" %}
This block is dependent on the following blocks being implemented:

* Initialization
* UOS
  {% endhint %}

### Transformation Code Requirements <a href="#transformation-code-requirements" id="transformation-code-requirements"></a>

The following code should be added to the main workflow in the appropriate position, after Google Analytics and before Order Channel and Marketing per the [Transform Code Sequence - DRP](/technical-docs/transform-code/transform-code/transform-code-sequence-drp.md) page

```
  #--------------------------------------------------------------------------------------------------------------------
  # SECTION: 2700_ORDER_STATUS
  # DEPENDENCIES:
  #   - Section: 0500_UOS
  # OPTIONAL:
  #   - Integration: Recharge if tagging subscription orders is needed
  # REQUIRED: No
  # PURPOSE: This code creates the DRP tables for order status and order business unit and should be turned on once
  # UOS is enabled
  #--------------------------------------------------------------------------------------------------------------------
  order_status:
    integrations:
      - shopify
      - amazon_seller_central
      - skubana
      - lightspeed
    scripts:
      - "github://platform-sql-shared/scripts/base/2700_order_status/2700_OST_BAS_orders_to_update.sql"
      - "github://platform-sql-shared/scripts/base/2700_order_status/2700_OST_BAS_order_status.sql"
      - "github://platform-sql-shared/scripts/base/2700_order_status/2710_OST_BAS_order_business_unit.sql"

  order_status_subscriptions:
    integrations:
      - recharge
    scripts:
      - "github://platform-sql-shared/scripts/base/2700_order_status/2701_OST_BAS_order_status_subscription_flag.sql"
```

### Order Status

{% hint style="success" %}
Add this code to create the \[`drp.order_status`] and \[`drp.order_business_unit`] tables to help identify the status and source of orders
{% endhint %}

This script determines what orders need to be updated and is used to drive a incremental approach to updates reducing CPU utilization for refreshing data.  We recommend that this code is always turned on

* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/2700_order_status/2700_OST_BAS_orders_to_update.sql>

These scripts create the two tables in this section of the data model

* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/2700_order_status/2700_OST_BAS_order_status.sql>
* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/2700_order_status/2710_OST_BAS_order_business_unit.sql>

{% hint style="info" %}
This code is only needed if you have Recharge and would like to include a flag to identify which orders are subscription orders
{% endhint %}

This script updates the \[`drp.order_status`] table and flags orders that are in Recharge

* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/2700_order_status/2701_OST_BAS_order_status_subscription_flag.sql>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.daasity.com/technical-docs/transform-code/transform-code/order-status-code.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
