Skip to main content

findOrCreateUOM

Requires permission products:product:create.

Find a unit of measure by name, ignoring case, or create it. A new unit gets the CUSTOM category, a code and symbol built from the name, and whole-number quantities. Used when importing product sheets. Needs the products create permission.

Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.

Example:

mutation FindOrCreateUOM($name: String!) {
findOrCreateUOM(name: $name) {
id
code
colorCode
name
pluralName
createdAt
conversionFrom {
id
createdAt
conversionFactor
deletedAt
deletedBy
enteredBy
}
}
}

Variables:

{
"name": "string"
}

Response:

{
"data": {
"findOrCreateUOM": {
"id": "id",
"code": "string",
"colorCode": "string",
"name": "string",
"pluralName": "string",
"createdAt": "2025-01-15T00:00:00Z",
"conversionFrom": [
{
"id": "id",
"createdAt": "2025-01-15T00:00:00Z",
"conversionFactor": 0,
"deletedAt": "2025-01-15T00:00:00Z",
"deletedBy": "string",
"enteredBy": "string"
}
]
}
}
}
findOrCreateUOM(
name: String!
): UnitOfMeasure!

Arguments​

findOrCreateUOM.name ● String! non-null scalar​

The unit's name. It is matched ignoring case and surrounding spaces.

Type​

UnitOfMeasure object​

A unit of measure in the organization's catalog, with its category, decimal rules and display settings.