Skip to main content

Create price book conditions

After you create a price book, set conditions with the createPriceBookCondition mutation. In the Preview release, the only supported condition is company ID. That is, you can only use price books to set custom prices for specific companies.

To use this mutation, you need two unique identifiers:

  • The priceBookId, which is the id value returned when you created the price book (see Create price books).

  • One or more company UUIDs, which you can retrieve with the List all companies REST API request.

Mutation

mutation createPriceBookCondition($createPriceBookConditionInput: CreatePriceBookConditionInput!) {
createPriceBookCondition(input: $createPriceBookConditionInput) {
condition {
id
name
description
conditions {
property
values
}
}
userErrors {
... on UserError {
__typename
message
}
}
}
}

Variables

{
"createPriceBookConditionInput": {
"priceBookId": "6beab4df-d944-4e52-8694-8bcf5b514015",
"name": "Company ID condition",
"createdBy": "john.smith@example.com",
"conditions": [
{
"property": "COMPANY_ID",
"values": [
"6b4bd452-895d-4098-aa56-e6046b238e0f"
]
}
]
}
}

Response

{
"data": {
"createPriceBookCondition": {
"condition": {
"id": "18333f2b-f87a-4501-ac2b-62e6e6d34c58",
"name": "Company ID condition",
"description": null,
"conditions": [
{
"property": "COMPANY_ID",
"values": [
"6b4bd452-895d-4098-aa56-e6046b238e0f"
]
}
]
},
"userErrors": null
}
}
}

Was this page helpful?