Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,149
Community Members
 
Community Events
184
Community Groups

Set custom field in config-as-code mode

Exploring the Compass product, I took the config-as-code way to manage our components.
For my components I setupped a simple custom field, a checkbox.
How I can set the value of the custom field with the YAML config file?
I read your guides about custom fields and YAML fields (https://developer.atlassian.com/cloud/compass/components/create-view-edit-and-delete-custom-fields/ and https://developer.atlassian.com/cloud/compass/config-as-code/structure-and-contents-of-a-compass-yml-file/ and https://community.atlassian.com/t5/Compass-Alpha-articles/Unleash-your-Custom-Field-creativity/ba-p/2030132), but no one expose a way to do this.
Exist a way to do this or this feature is not yet supported?

Thanks

1 answer

1 accepted

2 votes
Answer accepted
Josh Campbell
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Dec 15, 2022

Hey Daniele you've bumped into one of a few things config-as-code does not currently support. The ability to manage custom fields, labels, component type, and lifecycle are all missing right now and it's on our roadmap to correct this. I have also taken an action item to update our documentation and call this out.

That said, you can update custom field values programmatically using our GraphQL API using the updateComponent mutation. Here is a sample to point you in the right direction:

 

mutation compass_component_updateCustomField {
  compass {
    __typename
    updateComponent(
      input: {
        id: "yourComponentId"
        customFields: {
          textField: {
            definitionId: "yourCustomFieldDefinitionId",
            textValue: "New value"
          }
        }, 
      }
    ) {
      success
      errors {
        message
        extensions {
          errorType
          __typename
        }
        __typename
      }
      __typename
    }
  }
}

Hopefully this helps!

Hi Josh,
thanks for your reply. To help other with the same need, could be helpfull add some info. The field:

"definitionId: "yourCustomFieldDefinitionId"

requiring to provide the custom field id.

I haven't found a way to get the id of custom fields from Compass web site, so I used this GraphQL query:


query getComponentById($componentId: ID!) {
compass {
component(id: $componentId) {
__typename
... on CompassComponent {
name
typeId
customFields {
... on CompassCustomField {
__typename
... on CompassCustomBooleanField {
definition {
id
name
description
}
booleanValue
}
}
}
}
}
}
}

I used the CompassCustomBooleanField field, because my custom field is boolean type. It's possible use:

  • CompassCustomBooleanField
  • CompassCustomNumberField
  • CompassCustomTextField

If you have a easyest way, please share it.

That said, some questions:

  1. do you know when the ability to set this fields with YAML file, will be release?
  2. there are REST API to do the same?

Thanks for your support.

Josh Campbell
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jan 03, 2023 • edited

Hey Daniele sorry for the delay. I think you are asking if there is a better way to get all custom field IDs, if so try this:

query compass_customFields_getCustomFieldDefinitions {
compass {
customFieldDefinitions(query: {
cloudId: "yourCloudId"
}) {
... on CompassCustomFieldDefinitionsConnection {
nodes {
id
name
description
componentTypeIds
__typename
}
__typename
}
__typename
}
__typename
}
}

Answering your other questions:

1. I don't have a firm release date for supporting custom fields in config-as-code but I can tell you it's on our near term roadmap. I am aiming to ship several improvements to config-as-code first quarter of 2023, including this, but don't want to make any promises :) 

2. There is not, sorry. Is GraphQL a hurdle?

Hi Josh,
thanks for your reply.

Your query is more precise of mine, thanks.

GraphQL is powerfull, but we usually built our processes with YAML pipelines, that can easly integrate thirt part systems throught REST API.

Thanks for your support.

Like Josh Campbell likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events