hello, maybe a silly one, but graphQL is something completely new to me. I'm able to retrieve some informations using graphQL but overwriting existing data/creating is something i'm stuck in. Can someone please advise about syntax? i just stuckat sth like this:
@Szymon Wosiak are you trying to add options to custom fields so that they would be available in a dropdown?
If so, a mutation like this could work:
mutation AddOptionsToCustomField($input: CompassUpdateCustomFieldDefinitionInput!) {
compass {
updateCustomFieldDefinition(input: $input) {
success
errors {
message
extensions {
statusCode
errorType
}
}
customFieldDefinition {
id
... on CompassCustomSingleSelectFieldDefinition {
name
options {
id
value
}
}
... on CompassCustomMultiSelectFieldDefinition {
name
options {
id
value
}
}
}
}
}
}
With variables such as:
{
"input": {
"singleSelectFieldDefinition": {
"id": "ari:cloud:compass:YOUR_CLOUD_ID:custom-field-definition/YOUR_FIELD_ID",
"createOptions": [
"Option 1", "Option 2", "Option 3", "Option 4", "Option 5",
"Option 6", "Option 7", "Option 8", "Option 9", "Option 10"
]
}
}
}
You can query the results back with:
query GetCustomFieldDefinition($cloudId: ID!, $customFieldId: ID!) {
compass {
customFieldDefinition(query: { cloudId: $cloudId, id: $customFieldId }) {
... on CompassCustomSingleSelectFieldDefinition {
id
name
description
options {
id
value
}
}
... on CompassCustomMultiSelectFieldDefinition {
id
name
description
options {
id
value
}
}
}
}
}
With variables as:
{
"cloudId": "YOUR_CLOUD_ID",
"customFieldId": "ari:cloud:compass:YOUR_CLOUD_ID:custom-field-definition/YOUR_FIELD_ID"
}
Remember that you can also use the GraphQL Explorer in your site to build and test mutations and queries - yoursite.atlassian.net/gateway/api/graphql
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah, I would the primary way of updating a custom field in Compass is through UI (at least that's the primary supported method.
And yeah, GraphQL mutations can be tricky at first 👀
Like, official support documentation probably doesn't provide a working example or syntax for the updateCustomFieldDefinition mutation in GraphQL.
I did a quick look at Developer community but couldn't find anything specific. However, I believe this question might be better suited for the developer area > meaning, you'd probably get your (faster) answer if you post this question there. @Szymon Wosiak
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks for that, problem is that two fields have to have more than 25 options to select so i have no other way but crack it somehow :D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.