Shopify > NetSuite - order refunds

Introduction

A GraphQL query searches for orders in Shopify that were last modified after a given date, and are in a refunded state. The lookback date is calculated by referencing a date flow variable in the updated_at section of the GraphQL query.

The flow then searches for matching orders in NetSuite (using the order name), retrieving order details and order lines.

After this, a script determines which specific lines are being refunded by matching the return lines with their SKUs. It then creates an RMA (Return Merchandise Authorisation) from the sales order, followed by a credit memo.

The manual payload before the credit memo contains {} - this triggers the RMA ➤ credit memo conversion. The set variables shape sets a meta variable for rmaid , with the value derived from incoming Netsuite RMA IDs - this fully converts the RMA into a credit memo.

Process flow snapshot

Click to view process flow snapshot

Limitations

Limitation
Summary

Shopify GraphQL error handling

There is a known limitation with error handling for Shopify GraphQL. Please refer to the Error handling for Shopify GraphQL section for more information and a suggested approach that you may wish to adopt in your flows.

Assumptions

There are no assumptions to note for this flow.

Customisation

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

Flow variables

The table below summarises flow variables defined for this process flow.

Flow variable
Summary
Default value

date

Set the relative time period to look back for new orders in Shopify. Update the default value as required.

-30 minutes

For information on working with flow variables, please refer to our flow variables documentation.

Process flow shapes

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

Shape
Notes

Trigger

The default schedule is set to run every 30 minutes. You can edit this shape and define your preferred run schedule.

Keep in mind that the GraphQL query on the first Shopify connector retrieves orders that have been updated since your given lookback period (based on the value of the date flow variable). Ensure that the trigger schedule aligns with your lookback period.

Notify

This flow is designed in a try/catch structure, so notifications are generated if any part of the flow fails. To achieve this, the catch route includes a notify shape, which must be configured for your own notification preferences. Alert level: Defaults to error but can be changed if needed Channel: Defaults to email + log but can be changed if needed Email Limit: Defaults to 5 but can be changed if needed Notification Group: Replace the notify placeholder which your required notification group. Message: If required, you can change the placeholder message. For more information, please refer to our Notify shape and Notification groups pages.

Connector (Shopify)

If you did not add or select a Shopify instance during the blueprint installation process, the following settings must be configured: Source instance : Set to your required Shopify instance. Source endpoint : Set to POST Get refunded orders via graphql Variables : Leave the filter variable as it defaults. This variable references your date flow variable to determine the lookback period for new orders. Make sure this flow variable is set as required.

Connector (NetSuite)

If you did not add or select a NetSuite instance during the blueprint installation process, the following settings must be configured:

Source instance: Set to your required NetSuite instance.

Source endpoint : Set to POST suiteQL

Query: Leave as the default.

Connector (NetSuite)

If you did not add or select a NetSuite instance during the blueprint installation process, the following settings must be configured:

Source instance: Set to your required NetSuite instance.

Source endpoint : Set to POST Create RMA from sales order via transform

Variables: Leave NetSuite Sales Order ID as the default.

Connector (NetSuite)

If you did not add or select a NetSuite instance during the blueprint installation process, the following settings must be configured:

Source instance: Set to your required NetSuite instance.

Source endpoint : Set to POST Create credit memo from RMA via transform

Variables: Leave NetSuite RMA ID as the default.

Reference

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

Scripts in this process flow

Script
Summary

Determine refund lines for Netsuite

Checks order lines to determine what lines are needed for the refund.

Pull Netsuite ID from RMA header

Pulls the NetSuite ID from response so it can be used again.

Cross-reference lookups in this process flow

This process flow does not use cross-reference lookups.

Last updated

Was this helpful?