> For the complete documentation index, see [llms.txt](https://doc.wearepatchworks.com/product-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.wearepatchworks.com/product-documentation/blueprints/patchworks-blueprints/shopify-and-brightpearl/available-process-flows-shopify-and-brightpearl/shopify-greater-than-brightpearl-company-and-contact-update-create.md).

# Shopify > Brightpearl - company and contact update/create

## Introduction

This flow retrieves company, contact and location details from Shopify and creates/updates correlating details in Brightpearl.

## Process flow snapshot

<details>

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

<figure><img src="/files/ReWkHjL9AILkD1sWIXw7" alt=""><figcaption></figcaption></figure>

</details>

## Limitations

No limitations to note.

## Assumptions

<table><thead><tr><th width="266.79296875">Assumption</th><th>Summary</th></tr></thead><tbody><tr><td>Sync direction</td><td>Running this flow assumes that you want to sync data in this direction (i.e. from Shopify to Brightpearl). If required, a flow for the reverse direction is<a href="/pages/oSS9Hc95Izm25ZlTd4WB"> </a>available (<a href="/pages/C8lILiUHZhshvt9eQNal">Brightpearl > Shopify - create/update companies, contacts &#x26; payment terms</a>). You should run one or the other.</td></tr></tbody></table>

## 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>datesince</code></td><td>Set the relative number of days to look back for updates. Update the default value as required.<br><br>This variable is referenced in the first map shape in the flow, where a <code>custom string</code> transform passes the lookback value into the subsequent Shopify query.</td><td>-4 hours UTC</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.
{% endhint %}

<table data-full-width="false"><thead><tr><th width="230.578125">Shape</th><th>Notes</th></tr></thead><tbody><tr><td>Trigger</td><td>The default schedule for this flow is to run <code>every 4 hours at 0 minutes past the hour</code>. This is the recommended run frequency but the schedule can be changed if necessary.</td></tr><tr><td>Connector (Shopify)</td><td>If you did not add or select a Shopify instance during the blueprint <a href="/pages/IUEvmNmJ8fj8u3vFE4Rn">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 updated companies and contacts</code><br><code>Updated since</code> : Set to <code>[[payload.lookback]]</code></td></tr><tr><td>Connector (Brightpearl)</td><td>If you did not add or select a Brightpearl instance during the blueprint <a href="/pages/IUEvmNmJ8fj8u3vFE4Rn">installation process</a>, the following settings must be configured:<br><br><code>Source instance</code> : Set to your required <code>Brightpearl</code> instance.<br><code>Source endpoint</code> : Set to <code>GET Search company</code><br><code>Parameter</code> : Filter defined to retrieve only companies where the <code>name</code> field is set to <code>[[payload.company_name]]</code>.</td></tr><tr><td>Connector (Brightpearl)<br>branch: <code>new company</code><br>➤ branch: <code>first branch</code><br><br></td><td>If you did not add or select a Brightpearl instance during the blueprint <a href="/pages/IUEvmNmJ8fj8u3vFE4Rn">installation process</a>, the following settings must be configured:<br><br><code>Source instance</code> : Set to your required <code>Brightpearl</code> instance.<br><code>Source endpoint</code> : Set to <code>POST Create new locations</code></td></tr><tr><td>Connector (Brightpearl)<br>branch: <code>new company</code><br>➤ branch: <code>second branch</code><br><br></td><td>If you did not add or select a Brightpearl instance during the blueprint <a href="/pages/IUEvmNmJ8fj8u3vFE4Rn">installation process</a>, the following settings must be configured:<br><br><code>Source instance</code> : Set to your required <code>Brightpearl</code> instance.<br><code>Source endpoint</code> : Set to <code>POST Create new contacts</code></td></tr><tr><td>Connector (Brightpearl)<br>branch: <code>new company</code><br>➤ branch: <code>new branch</code><br><br></td><td>If you did not add or select a Brightpearl instance during the blueprint <a href="/pages/IUEvmNmJ8fj8u3vFE4Rn">installation process</a>, the following settings must be configured:<br><br><code>Source instance</code> : Set to your required <code>Brightpearl</code> instance.<br><code>Source endpoint</code> : Set to <code>POST Create company locations to company ID</code></td></tr><tr><td>Connector (Brightpearl)<br>branch: <code>update company</code><br>➤ branch: <code>create location ids</code></td><td>If you did not add or select a Brightpearl instance during the blueprint <a href="/pages/IUEvmNmJ8fj8u3vFE4Rn">installation process</a>, the following settings must be configured:<br><br><code>Source instance</code> : Set to your required <code>Brightpearl</code> instance.<br><code>Source endpoint</code> : Set to <code>POST Create new locations</code></td></tr><tr><td>Connector (Brightpearl)<br>branch: <code>update company</code><br>➤ branch: <code>new contacts</code></td><td>If you did not add or select a Brightpearl instance during the blueprint <a href="/pages/IUEvmNmJ8fj8u3vFE4Rn">installation process</a>, the following settings must be configured:<br><br><code>Source instance</code> : Set to your required <code>Brightpearl</code> instance.<br><code>Source endpoint</code> : Set to <code>POST Create new contacts</code></td></tr><tr><td>Connector (Brightpearl)<br>branch: <code>update company</code><br>➤ branch: <code>assign location id to company</code></td><td>If you did not add or select a Brightpearl instance during the blueprint <a href="/pages/IUEvmNmJ8fj8u3vFE4Rn">installation process</a>, the following settings must be configured:<br><br><code>Source instance</code> : Set to your required <code>Brightpearl</code> instance.<br><code>Source endpoint</code> : Set to <code>POST Create company locations to company ID</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>Brightpearl - determine new or current companies</td><td>Checks if the company is new or already exists in Brightpearl.</td></tr><tr><td>Brightpearl - create array of addresses</td><td>Put Shopify addresses into an array.</td></tr><tr><td>New company - assign location IDs to contacts</td><td>Assign location IDs (from location creation) to the contacts.</td></tr><tr><td>BP - new contact update locations</td><td>Adds contact IDs to locations.</td></tr><tr><td>Brightpearl - determine new contacts and new locations</td><td>Checks new contacts and locations for existing companies in Brightpearl.</td></tr><tr><td>Assign location IDs to contacts</td><td>Adds location IDs to new contacts for existing companies.</td></tr><tr><td>Determine id map for location add</td><td>Transforms location data and associates location ids.</td></tr></tbody></table>

### Cross-reference lookups in this process flow

This process flow does not use cross-reference lookups.
