# Shopify > NetSuite - sync locations

## Introduction

The `Shopify > NetSuite - sync locations` flow retrieves all locations from Shopify, then runs a [script](#scripts-in-this-process-flow) to check if they exist in NetSuite. New locations are created (via the first branch), address details for existing locations are updated (via the second branch), and locations with missing information are processed by the third branch.

{% hint style="info" %}
This blueprint includes two process flows to handle the sync of locations between Shopify and NetSuite - you only need to run ONE, depending on which way you want the sync to work:

* Shopify > NetSuite - sync locations (this flow)
* [NetSuite > Shopify - sync locations](https://doc.wearepatchworks.com/product-documentation/blueprints/patchworks-blueprints/shopify-and-netsuite/available-process-flows-shopify-and-netsuite/netsuite-greater-than-shopify-sync-locations)
  {% endhint %}

## Process flow snapshot

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FSUvxsp8XwrC9qsafJMIe%2Ficon%20process%20flow.svg?alt=media&#x26;token=ad1dc886-4a4e-4cad-9ad0-3d755e0f3b5a" alt="" data-size="line"> Click to view process flow snapshot</summary>

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FisbQaHRdiCw1qMRznZ0z%2FShopify%20%3E%20NetSuite%20-%20sync%20locations%20full%20flow.png?alt=media&#x26;token=5ade3333-92c6-4134-9b71-7d71caa94f27" alt="" data-size="original">

</details>

## Limitations

<table><thead><tr><th width="266.79296875">Limitation</th><th>Summary</th></tr></thead><tbody><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="../../installation-guide-shopify-and-netsuite/stage-5-review-update-and-test-process-flows-shopify-and-netsuite#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

The following cross-reference lookup tables must be updated before running this flow:

* [Shopify location > NetSuite location ID](https://doc.wearepatchworks.com/product-documentation/blueprints/patchworks-blueprints/installation-guide-shopify-and-netsuite/stage-1-patchworks-setup-shopify-and-netsuite#shopify-location-greater-than-netsuite-location-id)

Please ensure that you have completed the [necessary setup](https://doc.wearepatchworks.com/product-documentation/blueprints/patchworks-blueprints/installation-guide-shopify-and-netsuite/stage-1-patchworks-setup-shopify-and-netsuite#shopify-location-greater-than-netsuite-location-id) before proceeding.&#x20;

## 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

This process flow does not use flow variables.

### 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="190.171875">Shape</th><th>Notes</th></tr></thead><tbody><tr><td>Trigger</td><td>No default schedule is defined. If you decide that you want to sync locations in this direction (rather than from <a href="netsuite-greater-than-shopify-sync-locations">NetSuite to Shopify</a>), you may decide to add a schedule.</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="../../../../process-flows/building-process-flows/process-flow-shapes/standard-shapes/notify-shape">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="../../../../process-flows/building-process-flows/process-flow-shapes/standard-shapes/notify-shape">Notify shape</a> and <a href="../../../../general-settings/notification-groups">Notification groups</a> pages.</td></tr><tr><td>Connector (NetSuite)<br><br><code>Branch</code>: <code>First</code> </td><td><p>If you did not add or select a NetSuite instance during the blueprint <a href="../installation-guide-shopify-and-netsuite/stage-4-install-the-blueprint-shopify-and-netsuite">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>: Leave as the default</p></td></tr><tr><td>Connector (NetSuite)<br><br><code>Branch</code>: <code>Second</code> </td><td>If you did not add or select a Shopify instance during the blueprint <a href="../installation-guide-shopify-and-netsuite/stage-4-install-the-blueprint-shopify-and-netsuite">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 all locations via graphql</code></td></tr><tr><td>Notify <br><br><code>Branch</code>: <code>Missing information</code> </td><td><p>Configure the <a href="../../../../process-flows/building-process-flows/process-flow-shapes/standard-shapes/notify-shape">notify shape</a> for your own notification preferences in the event that locations have missing information. <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. </p><p><code>Message</code>: If required, you can change the placeholder message.<br><br>For more information please refer to our <a href="../../../../process-flows/building-process-flows/process-flow-shapes/standard-shapes/notify-shape">Notify shape</a> and <a href="../../../../general-settings/notification-groups">Notification groups</a> pages.</p></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>Shopify to NS - Determine new and updated locations</td><td>Compares shopify and netsuite locations and outputs those that are new those that to be updated.</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 Shopify location names to NetSuite location IDs. You must update this cross-reference lookup table before running this flow. Please see our <a href="../../installation-guide-shopify-and-netsuite/stage-1-patchworks-setup-shopify-and-netsuite#shopify-location-greater-than-netsuite-location-id">Installation &#x26; setup guide ➤ Stage 1: Patchworks setup</a>.</td></tr><tr><td>Inventory true/false</td><td>Used for location creation in NetSuite. This cross-reference lookup is set as required and does not need to be changed.</td></tr></tbody></table>
