attributesAddDefinition
Defines a custom field that can be set on one kind of record, such as “Material” on a product.
Business Rules
- The definition belongs to the company in the
X-Company-Idheader and to the kind of record inentityType - The name is unique among the company’s definitions for that kind of record, archived ones included
- A handle is derived from the name when omitted, and is unique under the same scope
attributeTypeis fixed at creationattributeClassis derived from the settings and the attribute type
Error Scenarios
- **
BAD_REQUEST**: the name is blank, longer than 80 characters, or already held by another definition - **
BAD_REQUEST**: the handle is malformed, longer than 50 characters, already held, or cannot be derived from the name - **
BAD_REQUEST**: the attribute group is longer than 100 characters - **
BAD_REQUEST**: naming the archived definition that holds the name or the handle, which is restored throughattributesUpdateDefinitionrather than created again - **
CompanyContextRequired**: no company is in context
Permissions Required
- The add permission of the entity type, such as
products:add_attribute_definitionforPRODUCT
attributesAddDefinition(
input: AttributesAddDefinitionInput!
): AttributeDefinition!
Arguments
attributesAddDefinition.input ● AttributesAddDefinitionInput! non-null input common
Parameters for AttributesAddDefinition
Type
AttributeDefinition object common
A custom field that can be set on a record, such as “Material” on a product.