# Shopify > NetSuite - sales order creation

## Introduction

This flow retrieves orders from Shopify that were created in a `paid` or `pending` state, based on the order's financial status. Depending on this state, orders are sent down one of two branches:

* **Paid orders**. The order is created in NetSuite against the relevant company, then a customer deposit is applied, and an invoice is raised.
* **Unpaid orders**. The order is created in NetSuite against the relevant company, but no documents are created (payment can be made through NetSuite when ready).&#x20;

## Process flow snapshot

<details>

<summary><img src="/files/y1IE71BfODU6ZRj1HNMM" alt="" data-size="line"> Click to view process flow snapshot</summary>

<img src="/files/sffygyGHAj3JSyhp91i1" alt="" data-size="original">

</details>

## Limitations

<table><thead><tr><th width="316.98828125">Limitation</th><th>Summary</th></tr></thead><tbody><tr><td>One <code>subsidiary ID</code> is supported.</td><td>You must apply the required ID before running this flow - please see <code>Customisation</code> ➤ <code>Process flow shapes</code> for more information.</td></tr><tr><td>This flow expects new orders </td><td>This flow does not support updating existing orders.</td></tr><tr><td> Cash sales are not supported.</td><td>N/A</td></tr><tr><td>Order details</td><td>Mappings are defined for standard orders. If required, mappings can be added for more complex orders (e.g. discounts and gift cards).</td></tr><tr><td>Shopify GraphQL error handling</td><td>There is a known limitation with error handling for Shopify GraphQL. Please refer to the <a href="/pages/cAsDFgC7o0rXqfyJWolv#error-handling-for-shopify-graphql">Error handling for Shopify GraphQL</a> section for more information and a suggested approach that you may wish to adopt in your flows. </td></tr></tbody></table>

## Assumptions

* Companies must be synced in both systems (see [NetSuite > Shopify - create/update companies, contacts & payment terms](/product-documentation/blueprints/patchworks-blueprints/shopify-and-netsuite/available-process-flows-shopify-and-netsuite/netsuite-greater-than-shopify-create-update-companies-contacts-and-payment-terms.md) and [Shopify > NetSuite - create/update companies, locations & contacts](/product-documentation/blueprints/patchworks-blueprints/shopify-and-netsuite/available-process-flows-shopify-and-netsuite/shopify-greater-than-netsuite-create-update-companies-locations-and-contacts.md)).
* Products must be synced in both systems (see [Shopify > NetSuite - create & update products](/product-documentation/blueprints/patchworks-blueprints/shopify-and-netsuite/available-process-flows-shopify-and-netsuite/shopify-greater-than-netsuite-create-and-update-products.md)).
* The following cross-reference lookup tables must be updated before running this flow: [Shopify location > NetSuite location ID](/product-documentation/blueprints/patchworks-blueprints/shopify-and-netsuite/installation-guide-shopify-and-netsuite/stage-1-patchworks-setup-shopify-and-netsuite.md#shopify-location-greater-than-netsuite-location-id). Please ensure that you have completed the [necessary setup](/product-documentation/blueprints/patchworks-blueprints/shopify-and-netsuite/installation-guide-shopify-and-netsuite/stage-1-patchworks-setup-shopify-and-netsuite.md#shopify-location-greater-than-netsuite-location-id) before proceeding.&#x20;
* NetSuite permissions are required to create invoices, customer deposits, and the ability to create invoices without fulfilment (see [Installation ➤ Stage 2: NetSuite prerequisites](/product-documentation/blueprints/patchworks-blueprints/shopify-and-netsuite/installation-guide-shopify-and-netsuite/stage-2-netsuite-prerequisites-shopify-and-netsuite.md)). &#x20;
* Your NetSuite `subsidiary ID` must be applied before running this flow.  - please see `Customisation` ➤ `Process flow shapes` for more information.
* This flow assumes that SKUs are stored in NetSuite's `upccode` field. If you use a different field to store this value, any connector queries, mappings and scripts referencing the `upccode` field must be updated. Please see the [Customisation ➤ process flow shapes](#process-flow-shapes) section for details.

## Customisation

To ensure that this process flow runs as required, some customisation options are available. These are documented in the following sections:

* [Flow variables](#flow-variables)
* [Process shape shapes](#process-flow-shapes)

### Flow variables

The table below summarises [flow variables](/product-documentation/process-flows/building-process-flows/dynamic-variables/flow-variables.md) defined for this process flow.

<table><thead><tr><th width="163.5078125">Flow variable</th><th>Summary</th><th>Default value</th></tr></thead><tbody><tr><td><code>date</code></td><td>Set the relative time period to look back for new orders in Shopify. Update the default value as required.</td><td>-1 minute</td></tr></tbody></table>

{% hint style="info" %}
For information on working with flow variables, please refer to our [flow variables documentation](/product-documentation/process-flows/building-process-flows/dynamic-variables/flow-variables.md).
{% endhint %}

### Process flow shapes

This process flow includes some shapes that can be configured with your own settings. Please see guidelines in the table below.

{% hint style="warning" %}
Shape settings determine the outcome of process flows. Do not change shape settings unless they are listed below.&#x20;
{% endhint %}

<table data-full-width="false"><thead><tr><th width="165.34375">Shape</th><th>Notes</th></tr></thead><tbody><tr><td>Trigger</td><td>The default setting is to run hourly, which is recommended. You can change the schedule if required. Keep in mind that <a href="#flow-variables">flow variables</a> determine the lookback period, so these settings should align. </td></tr><tr><td>Notify</td><td>This flow is designed in a try/catch structure, so notifications are generated if any part of the flow fails. To achieve this, the <code>catch</code> route includes a <a href="/pages/qJOdm6pHm3I8Ovog6Ola">notify shape</a>, which must be configured for your own notification preferences. <br><br><code>Alert level</code>: Defaults to <code>error</code> but can be changed if needed<br><code>Channel</code>: Defaults to <code>email + log</code> but can be changed if needed<br><code>Email Limit</code>: Defaults to <code>5</code> but can be changed if needed<br><code>Notification Group</code>: Replace the <code>notify</code> placeholder which your required notification group. <br><code>Message</code>: If required, you can change the placeholder message.<br><br>For more information, please refer to our <a href="/pages/qJOdm6pHm3I8Ovog6Ola">Notify shape</a> and <a href="/pages/ul3TLNVYRLYUGugTOFLU">Notification groups</a> pages.</td></tr><tr><td>Connector (Shopify)</td><td>If you did not add or select a Shopify instance during the blueprint <a href="/pages/ZuNUyYvEy14sajACk8N9">installation process</a>, the following settings must be configured:<br><br><code>Source instance</code> : Set to your required <code>Shopify</code> instance.<br><code>Source endpoint</code> :  Set to <code>POST Get orders via graphql</code><br><code>Variables</code> : Leave the <code>filter</code> variable as it defaults. This variable references your <code>date</code> flow variable to determine the lookback period for new orders. Make sure this <a href="#flow-variables">flow variable</a> is set as required.</td></tr><tr><td>Connector (NetSuite)</td><td><p>If you did not add or select a NetSuite instance during the blueprint <a href="/pages/ZuNUyYvEy14sajACk8N9">installation process</a>, the following settings must be configured:</p><p></p><p><code>Source instance</code>: Set to your required <code>NetSuite</code> instance.</p><p><code>Source endpoint</code> :  Set to <code>POST suiteQL</code></p><p><code>Query</code>: Leave as the default.</p></td></tr><tr><td>Connector (NetSuite)<br><br>Route: <code>Paid orders</code></td><td><p>If you did not add or select a NetSuite instance during the blueprint <a href="/pages/ZuNUyYvEy14sajACk8N9">installation process</a>, the following settings must be configured:<br><br><code>Source instance</code> : Set to your required <code>NetSuite</code> instance.<br><code>Source endpoint</code> :  Set to <code>POST suiteQL</code></p><p><code>Query</code>: SuiteQL compares SKUs to a value in NetSuite. This NetSuite connector is configured with a query that expects the comparison value in <code>upccode</code>. If you use a different field, please update the query accordingly.</p></td></tr><tr><td>Connector (Shopify)<br><br>Route: <code>Paid orders</code></td><td>If you did not add or select a Shopify instance during the blueprint <a href="/pages/ZuNUyYvEy14sajACk8N9">installation process</a>, the following settings must be configured:<br><br><code>Source instance</code> : Set to your required <code>Shopify</code> instance.<br><code>Source endpoint</code> :  Set to <code>POST Get fulfillment location of order via graphql</code> <br><code>Variables</code> : Leave the <code>order ID</code> variable as it defaults. </td></tr><tr><td>Map<br><br>Route: <code>Paid orders</code></td><td><p>You must update the custom string transform function associated with the subsidiary.id mapping rule:</p><p></p><p><img src="/files/x8R83371xf4T2SPoKeoB" alt=""><br><br>For more information about working with the custom string transform documentation, please see our <a href="/pages/wqvOoFy5bcZqomDzmT10">custom string</a> documentation.</p></td></tr><tr><td>Connector (NetSuite)<br><br>Route: <code>Paid orders</code></td><td>If you did not add or select a NetSuite instance during the blueprint <a href="/pages/ZuNUyYvEy14sajACk8N9">installation process</a>, the following settings must be configured:<br><br><code>Source instance</code> : Set to your required <code>NetSuite</code> instance.<br><code>Source endpoint</code> :  Set to <code>POST create sales order</code><br><br><br></td></tr><tr><td>Connector (NetSuite)<br><br>Route: <code>Paid orders</code></td><td>If you did not add or select a NetSuite instance during the blueprint <a href="/pages/ZuNUyYvEy14sajACk8N9">installation process</a>, the following settings must be configured:<br><br><code>Source instance</code> : Set to your required <code>NetSuite</code> instance.<br><code>Source endpoint</code> :  Set to <code>POST create customer deposit</code> </td></tr><tr><td>Connector (NetSuite)<br><br>Route: <code>Paid orders</code></td><td>If you did not add or select a NetSuite instance during the blueprint <a href="/pages/ZuNUyYvEy14sajACk8N9">installation process</a>, the following settings must be configured:<br><br><code>Source instance</code> : Set to your required <code>NetSuite</code> instance.<br><code>Source endpoint</code> :  Set to <code>POST transform SO into invoice</code>     </td></tr><tr><td>Connector (NetSuite)<br><br>Route: <code>Unpaid orders</code></td><td><p>If you did not add or select a NetSuite instance during the blueprint <a href="/pages/ZuNUyYvEy14sajACk8N9">installation process</a>, the following settings must be configured:<br><br><code>Source instance</code> : Set to your required <code>NetSuite</code> instance.<br><code>Source endpoint</code> :  Set to <code>POST suiteQL</code></p><p><code>Query</code>: SuiteQL compares SKUs to a value in NetSuite. This NetSuite connector is configured with a query that expects the comparison value in <code>upccode</code>. If you use a different field, please update the query accordingly.</p></td></tr><tr><td>Connector (Shopify)<br><br>Route: <code>Unpaid orders</code></td><td>If you did not add or select a Shopify instance during the blueprint <a href="/pages/ZuNUyYvEy14sajACk8N9">installation process</a>, the following settings must be configured:<br><br><code>Source instance</code> : Set to your required <code>Shopify</code> instance.<br><code>Source endpoint</code> :  Set to <code>POST Get fulfillment location of order via graphql</code> <br><code>Variables</code> : Leave the <code>order ID</code> variable as it defaults. </td></tr><tr><td>Map<br><br>Route: <code>Unpaid orders</code></td><td><p>You must update the custom string transform function associated with the subsidiary.id mapping rule:</p><p></p><p><img src="/files/cTRjwGKJm1s9LfNmKmQR" alt=""><br><br>For more information about working with the custom string transform documentation, please see our <a href="/pages/wqvOoFy5bcZqomDzmT10">custom string</a> documentation.</p></td></tr><tr><td>Connector (NetSuite)<br><br>Route: <code>Unpaid orders</code></td><td>If you did not add or select a NetSuite instance during the blueprint <a href="/pages/ZuNUyYvEy14sajACk8N9">installation process</a>, the following settings must be configured:<br><br><code>Source instance</code> : Set to your required <code>NetSuite</code> instance.<br><code>Source endpoint</code> :  Set to <code>POST create sales order</code></td></tr></tbody></table>

## Reference

Reference information for this process flow is documented in the following sections:

* [Scripts used in this process flow](#scripts-in-this-process-flow)
* [Cross-reference lookups used in this process flow](#cross-reference-lookups-in-this-process-flow)

### Scripts in this process flow

<table><thead><tr><th width="293">Script</th><th>Summary</th></tr></thead><tbody><tr><td> Add single quotes to products</td><td>Adds single quotes to products so they can be searched correctly in Netsuite.</td></tr><tr><td> Merge NS ID to line items</td><td>Pushes the NetSuite ID into line items from the previous payload for cleaner mapping.</td></tr><tr><td> Pulls SO ID from header</td><td>Pulls the NetSuite order ID from the header so it can be used again.</td></tr></tbody></table>

### Cross-reference lookups in this process flow

<table><thead><tr><th width="322.93359375">Cross-reference lookup</th><th>Summary</th></tr></thead><tbody><tr><td>Shopify location > Netsuite Location ID</td><td>Maps locations from Shopify to NetSuite. Requires <a href="/pages/AsLYtyyBZHbM6QMimbFu#shopify-location-greater-than-netsuite-location-id">setup before this process flow is used</a>. </td></tr></tbody></table>


---

# 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://doc.wearepatchworks.com/product-documentation/blueprints/patchworks-blueprints/shopify-and-netsuite/available-process-flows-shopify-and-netsuite/shopify-greater-than-netsuite-sales-order-creation.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.
