Hey,
I just did this tutorial about adding a custom CQL field to Confluence: https://developer.atlassian.com/server/confluence/adding-a-field-to-cql/
That’s no problem, but how the hell do I put values in custom CQL fields?
There is nothing written in the tutorial that would help and I can’t see any option to put values in those field in the Confluence backend.
I don’t think this is a hard question… But I can't fiend any answer...
Hello Hauke,
Thanks for providing the reference to where you’re working with for the tutorial. From reviewing the tutorial there is a section which breaks down the CQL requirements to be used within a field. This is within Step 2 and is listed like the following example:
To add a field, we need to add the following to atlassian-plugin.xml file:
<cql-query-field fieldName="status"
key="status-field" name="Content Status Field"
class="com.example.plugins.tutorial.confluence.impl.StatusFieldHandler">
<ui-support value-type="string" default-operator="=" i18n-key="cql.field.status" data-uri="/rest/status-field/status-values"/>
</cql-query-field>
The cql-query-field declaration is what defines a new CQL field.
Attribute |
Purpose |
fieldName |
Name of the field that will be used in CQL statements. |
key |
Unique ID of this CQL field declaration in the plugin. |
name |
A human readable name for the field. |
class |
The implementation of the CQL field. This should extend the com.atlassian.querylang.fields.BaseFieldHandler class |
This information points to where the CQL will be included along with the name/fields to be used for the options. The above was provided from Adding a field to CQL.
I hope this example helps and guides you in progressing through the tutorial.
Regards,
Stephen Sifers
Thank you for your answer, but unfortunately that wasn't my problem. I finished the tutorial and everything is working fine, I have the status field in my advanced search view.
But I don't understand how to use this new field. I thought I could put information into it for each page I have, to stay in the tutorial context, one page I give the info X for my newly created "status" field, and one gets Y and I could filter for those values in advanced search.
So if I would filter in a CQL search for value Y in "status" field, I would only get pages with "status" field information Y as search result.
But that's not how it works? Or how could I put those X or Y-information in my "status" fields for each page I have?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Hauke,
To understand more about what you're wanting to do via CQL I will need to see an example. Could you please provide an example of a CQL statement you're attempting to use?
This will help us to review and understand where you're having issues with your CQL statement.
Regards,
Stephen Sifers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
thanks for your answer.
I want to have some searchable fields on each page, where I can put information in.
Because I want to filter my search results by that information in those searchable fields I added.
Now I'm saving some extra information for each page with the contentPropertyManager, but that's not searchable.
So I thought searchable CQL fields just sound like what I'm searching for, but I don't get it how they work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Hauke,
From what you're explaining, it sounds like you’d be better served by using labels on Confluence pages and searching via CQL for those labels. CQL is simply the Confluence Query Language that allows you to query pages. Labels are a field which CQL can be used on. Further information on labels may be found at Add, Remove and Search for Labels.
Here is the documentation which samples how to use CQL when searching for labels: https://developer.atlassian.com/server/confluence/cql-field-reference/#label.
I hope this new information proves helpful and you’re able to more easily search and find your content.
Regards,
Stephen Sifers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your reply.
But I'm using labels for other stuff on my site so that's no option.
I just need some custom field on each page where I can put information in that can be changed via User Macros and can be searched by CQL queries.
So I thought that's what CQL field do, but I didn't get how to put or change their content (via user macro).
Best regards
Edit:
Here somebody told me how to put information in CQL fields: https://community.developer.atlassian.com/t/how-to-use-custom-cql-fields/29965/2
But how can I change my custom CQL field content via a User Macro?
Now I'm using $contentPropertyManager.setTextProperty($content, "Info1", $paramInfo1) in a User Macro for saving custom information with each page, but that's now searchable via CQL I think.
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.