> ## Documentation Index
> Fetch the complete documentation index at: https://docs.global-e.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GlobaleOrderNotifications

This job is part of the default Global-e SFCC cartridge functionality. **GlobaleOrderNotifications** sends order update notifications from SFCC to Global-e when such notifications are in the integration scope.

Each job step processes notification custom objects created when the corresponding outbound hook is invoked. Schedule the job to run every 15 minutes when outbound notifications are enabled.

See also: [Jobs overview](/jobs-sfcc), [Order lifecycle](/order-lifecycle-sfcc), [Hooks](/hooks-sfcc).

## Job steps

| Step | Step type | Default in `jobs.xml` | Description |
| - | - | - | - |
| UpdateOrderStatus | `custom.GlobaleUpdateOrderStatus` | Enabled | Sends order status updates (for example, cancellation) to Global-e |
| UpdateOrderDispatch | `custom.GlobaleUpdateOrderDispatch` | Enabled | Sends `UpdateOrderDispatchV2` notifications |
| CreateOrderRefund | `custom.GlobaleCreateOrderRefund` | Enabled | Sends `CreateOrderRefund` notifications |
| UpdateRMA | `custom.GlobaleUpdateRMA` | Disabled (`geDisableJobStep: true`) | Sends RMA update notifications |
| UpdateParcelStatus | `custom.GlobaleUpdateParcelStatus` | Not in default `jobs.xml` | Sends parcel status updates (add to job definition when required) |

Payload formats for each notification type are defined in the corresponding Global-e API documentation (UOS, UODv2, COR, UpdateRMA, UpdateParcelStatus), which is not included in the cartridge package.

## UpdateOrderStatus

When an order is cancelled on the SFCC side, send an order status update notification to Global-e (depending on integration scope).

### How it works

1. Trigger the custom hook `globale.outboundOrderStatusUpdate` when an order is cancelled, using `globaleHooksHelper`:

```javascript theme={null}
var globaleHooksHelper = require('*/cartridge/scripts/helpers/globaleHooksHelper');
var globaleHelpers = require('*/cartridge/scripts/helpers/globaleHelpers');
globaleHooksHelper.invokeCustomHook(
    globaleHelpers.hooks.jobs.outboundOrderStatusUpdate,
    'GE10080871180GB',
    {
        OrderId: 'GE10080871180GB',
        OrderStatus: { OrderStatusCode: 'CANCELLED', Name: 'CANCELLED' },
        OrderStatusReason: { OrderStatusReasonCode: 'CANCELLED', Name: 'CANCELLED' }
    }
);
```

2. The hook creates a notification custom object that this job step sends to the Global-e API.

### Required customization

Trigger `globale.outboundOrderStatusUpdate` with the correct order number and payload when an order is cancelled on the SFCC side.

## UpdateOrderDispatch

When an order is dispatched, send an order dispatch notification to Global-e.

### How it works

Trigger `globale.outboundOrderDispatchUpdate`:

```javascript theme={null}
var globaleHooksHelper = require('*/cartridge/scripts/helpers/globaleHooksHelper');
var globaleHelpers = require('*/cartridge/scripts/helpers/globaleHelpers');
globaleHooksHelper.invokeCustomHook(
    globaleHelpers.hooks.jobs.outboundOrderDispatchUpdate,
    'GE10083988760GB',
    {
        OrderId: 'GE10083988760GB',
        IsCompleted: true,
        Parcels: [{
            ParcelCode: 'GE10083988760GB',
            Products: [{ DeliveryQuantity: 1, ProductCode: '793775370033M' }]
        }]
    }
);
```

### Required customization

Trigger `globale.outboundOrderDispatchUpdate` when a dispatch notification should be sent.

## CreateOrderRefund

When an order refund should be issued, send a refund notification to Global-e.

### How it works

Trigger `globale.outboundOrderRefundUpdate`. The payload must include `header` and `body` properties:

```javascript theme={null}
var globaleHooksHelper = require('*/cartridge/scripts/helpers/globaleHooksHelper');
var globaleHelpers = require('*/cartridge/scripts/helpers/globaleHelpers');
globaleHooksHelper.invokeCustomHook(
    globaleHelpers.hooks.jobs.outboundOrderRefundUpdate,
    'GE10083988760GB',
    {
        header: { OrderId: 'GE10083988760GB' },
        body: [{ CartItemId: 1, RefundQuantity: 1 }]
    }
);
```

### Required customization

Trigger `globale.outboundOrderRefundUpdate` when a refund notification should be sent.

## UpdateRMA

Sends RMA update notifications to Global-e. Use case: provide the merchant internal RMA number instead of the Global-e RMA number.

Additional context may be available in your Global-e RMA integration documentation.

### How it works

Trigger `globale.outboundOrderRMAUpdate`:

```javascript theme={null}
var globaleHooksHelper = require('*/cartridge/scripts/helpers/globaleHooksHelper');
var globaleHelpers = require('*/cartridge/scripts/helpers/globaleHelpers');
globaleHooksHelper.invokeCustomHook(
    globaleHelpers.hooks.jobs.outboundOrderRMAUpdate,
    'GE10084013107GB',
    {
        OrderId: 'GE10084013107GB',
        MerchantOrderId: '00042703',
        RMANumber: '277145',
        MerchantRMANumber: 'RMA277145'
    }
);
```

Enable the **UpdateRMA** step in Business Manager (set `geDisableJobStep` to `false`) when this notification type is in scope.

### Required customization

Trigger `globale.outboundOrderRMAUpdate` when an RMA notification should be sent.

## UpdateParcelStatus

Sends parcel status update notifications to Global-e. Use case: update asynchronous parcel status when live API calls fail (for example, due to network issues).

This step type is defined in the cartridge (`custom.GlobaleUpdateParcelStatus`) but is not included in the default `jobs.xml`. Add it to the **GlobaleOrderNotifications** job definition when required.

### How it works

Trigger `globale.outboundParcelStatusUpdate`:

```javascript theme={null}
var HookMgr = require('dw/system/HookMgr');

var orderId = 'GE101860768GB';
var parcelCode = 'someParcelCode';
var payload = {
    merchantParcelStatusCode: 'Delivered'
};

var hookCallResult = HookMgr.callHook(
    'globale.outboundParcelStatusUpdate',
    'outboundParcelStatusUpdate',
    orderId,
    parcelCode,
    payload
);

return hookCallResult;
```

If the live Global-e API call fails, a notification custom object is created for the job step to retry.

### Required customization

Trigger `globale.outboundParcelStatusUpdate` when a parcel status notification should be sent.
