Skip to main content

findOrCreateBrand

Requires permission products:brand:create.

Returns the brand with this name, matched without regard to case, or creates it when none exists. A new brand gets a generated code. An empty name is refused. Needs the brands 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 FindOrCreateBrand($name: String!) {
findOrCreateBrand(name: $name) {
id
code
name
createdAt
deletedAt
deletedBy
products {
id
name
status
createdAt
basePrice
baseUOMId
}
}
}

Variables:

{
"name": "string"
}

Response:

{
"data": {
"findOrCreateBrand": {
"id": "id",
"code": "string",
"name": "string",
"createdAt": "2025-01-15T00:00:00Z",
"deletedAt": "2025-01-15T00:00:00Z",
"deletedBy": "string",
"products": [
{
"id": "id",
"name": "string",
"status": "ACTIVE",
"createdAt": "2025-01-15T00:00:00Z",
"basePrice": 0,
"baseUOMId": "id"
}
]
}
}
}
findOrCreateBrand(
name: String!
): Brand!

Arguments​

findOrCreateBrand.name ● String! non-null scalar​

The brand name. Leading and trailing spaces are ignored.

Type​

Brand object​

A brand products are made or sold under.