---
schema_version: "1"
id: fc8d5dfa258cf01bf9fbbdbc2305dbf86a770262d9311592e81fe12f8fb3f0b0
title: orderExtensionUtils Service Component
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ind/264-0-0/cg_task_admin_orderextension_service_component.md
canonical_url: https://help.salesforce.com/s/articleView?id=ind.cg_task_admin_orderextension_service_component.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 5c3d8bde6c8bbe5b0e09bfe0cf1374bed3b63b44961de9881d95e5f3ed13c6e1
description: To extract data from orders and push new data into orders, use the orderExtensionUtils service component to hook on the order state.
products:
  - Consumer Goods
release: "264"
---
# orderExtensionUtils Service Component

To extract data from orders and push new data into orders, use the orderExtensionUtils service component to hook on the order state.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition">
        <colgroup>
          <col>
        </colgroup>
        <tbody>
          <tr class="">
            <td class="slds-cell-wrap" style="vertical-align:top;">
              <p>Available in: Lightning Experience</p>
              <p style="margin-bottom:0;">Available in: <strong>Enterprise</strong> and
                <strong>Unlimited</strong> Editions that have Consumer Goods Cloud enabled
              </p>
            </td>

          </tr>
        </tbody>
      </table>

```
<!-- CustomComponent.html -->
<template>
    <!-- Sample button -->
    <lightning-button variant="neutral" label="Update Order Field" onclick={updateOrderFieldValue}></lightning-button>
</template>

<!-- CustomComponent.js -->
import { LightningElement, api } from 'lwc';
import { getOrderData, updateOrderData } from 'cgcloud/orderExtensionUtils';

export default class CustomComponent extends LightningElement {
  @api recordId;
  initialOrderData = {};

  connectedCallback() {
    getOrderData(this.recordId).then((data) => {
      this.initialOrderData = data;
    });
  }

  // You can invoke this method with the click of a button
  updateOrderFieldValue() {
    const fieldName = 'cgcloud__Delivery_Note__c';
    const newValue = 'test-note';

    updateOrderData(this.recordId, this, fieldName, newValue);
  }
}

<!-- CustomComponent.js-meta.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>59.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__RecordPage</target>
    </targets>
    <targetConfigs>
        <targetConfig targets="lightning__RecordPage">
            <objects>
                <object>cgcloud__Order__c</object>
            </objects>
        </targetConfig>
    </targetConfigs>
    <runtimeNamespace>cgcloud</runtimeNamespace>
</LightningComponentBundle>
```

## Considerations for using the orderExtensionUtils component:

- If your org has [Lightning Web Security](https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.security_lwsec_intro) enabled, the runtimeNamespace property on the metadata file isn’t required. You must test the Lightning web security feature before it’s enabled. See [LWC Security](https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.security_lwsec_when) for more information.
- When you specify a runtimeNamespace in the metadata file, your component can’t access “@salesforce” resources. To perform APEX calls and other actions that require Salesforce modules, use the available functions in the retailGenericUtils module.
- When your component doesn’t have the runtimeNamespace property set up on the metadata file, the system throws an error. To fix it, add the runtimeNamespace property with the namespace cgcloud to your component.
- When your component includes other custom components that don’t have the runtimeNamespace property in their metadata file, add the runtimeNamespace property with the namespace cgcloud to all the included components. Also add this property to the child components.