Fluent Commerce Logo
Docs

Query Create and Update Customer via GraphQL

Essential knowledge

Author:

Fluent Commerce

Changed on:

12 July 2024

Overview

A best practice guide of creating customer entity.

Key points

  • A user guide on how to manage customer entities in OMS.
  • Best practice guide on creating Customer entity in OMS before the createOrder mutation.
  • Relationship between user entity and customer entity.

Query Customer in OMS

The user can use the `customers` or `customer` queries to search/retrieve customer data in the OMS.The GraphQL schema can be found here:https://api.production.shared-sydney-01.fluentcommerce.com/graphql/docs/operation/query/Here is a sample GraphQL `customer` query:

Create Customer in OMS

The user can use the `createCustomer` mutation to create a customer entity in the OMS.The GraphQL schema can be found here:https://api.production.shared-sydney-01.fluentcommerce.com/graphql/docs/mutation/createcustomer/Here is a sample GraphQL `createCustomer` mutation:

Update Customer in OMS

The user can use the `updateCustomer` mutation to update a customer entity in the OMS.The GraphQL schema can be found here:https://api.production.shared-sydney-01.fluentcommerce.com/graphql/docs/mutation/updatecustomer/Here is a sample GraphQL `updateCustomer` mutation:

Best practice for creating Customers in OMS

Validate customer details before Order Creation
Since the `createOrder` mutation requires a customer ID, the below flowchart demonstrates the best practice for creating a customer:No alt provided

Ensure the customer username is unique across the account, not just the retailer.
The customer entity is located at the retailer level (same as the Order entity) in the OMS data structure.  It is a best practice to ensure the customer->username is unique across the Account level, not just the retailer level.  This will reduce any confusion when it comes to cross-retailer setup.