Adding suggestions for searcher

Hello Guys,

I’m developing a searcher for my CF type and the search functionality is working perfectly. I just need to enhance it by adding an input helper, so, it gives all suggested values for the user (just like attached picture). Can you please give me a hint on how to do that? (what is the component responsible for this functionality?)


thanks,
Rosy

1 Like

Hello Guys,
Any updates on the above please?
Can You please help?

thanks,
Rosy

Hey @rosy.salame,

I just moved your question to the JIRA Server Development category so it will get the right people looking at it.

Cheers,
Peter

thanks a lot @pvandevoorde!

Hello Guys,

Can someone help me? I just want to know which component is responsible of rendering the suggestions of a multiselect CF in JQL .

thanks,
Rosy

You are probably referring to the “search” resource that you include within your searcher’s definition:

<resource type="velocity" name="search"  
    location="templates/plugins/fields/search-userpicker.vm" />

You’ll find references to JIRA’s own search templates in system-customfieldtypes-plugin.xml in the JIRA source code.

2 Likes

Thank you @david.pinn, I will try to create my own search template (as my CF type is of type Company where Company is a customized object created). I will let you know my findings.
thank you for your help!
Rosy

Hi @david.pinn,

I’ve created my own search template search-multiselect-company.vm under /templates/fields/searchers/ folder and I’ve only put a hardcoded value inside it : testValue just to see if this is being triggered.
I have added it in my atlassian-plugin.xml:

<customfield-searcher key="crm-company-searcher" name="CRM Company Searcher" i18n-name-key="customfield.searcher.crm-company.name" class="com.murex.plugin.jira.customfields.searchers.CRMCompanySearcher">
      <description key="customfield.searcher.crm-company.description">Allow searching for a company name</description>
      <resource type="velocity" name="search" location="/templates/fields/searchers/search-multiselect-company.vm"/>
      <valid-customfield-type package="${project.groupId}.${project.artifactId}" key="crm-company"/>
    </customfield-searcher>

But, when trying to search for this custom field in issue navigator, I didn’t get “testValue” word after the operator “=”.

Did I miss something?
thank you,
Rosy

Try putting a select tag into your .vm file. Here’s a peek at one I use:

#disable_html_escaping()
$!{auiparams.put("controlHeaderClass", "aui-field-multiselect")}
#searcherEditHeader (${customField.id} ${customField.name})
<select class="select js-default-checkboxmultiselect" id="searcher-$customField.id"
        data-placeholder-text="${i18n.getText("com.projectbalm.riskregister.customfield.exposure.searcher.placeholder")}"
        multiple="multiple" name="$customField.id" size="#minSelectSize ($configs.options 1 5)">
    #foreach ($option in $options)
        #set ($name = $cfValueEncoder.encodeForHtml($option.getName()))
        #set ($id = $option.Id)
        #set ($selected = $value && $value.contains($id.toString()))
        <option #if($selected)selected="selected" #{end}title="$name" value="$id">$name</option>
    #end
</select>
#searcherEditFooter (${customField.id} '')
$!{auiparams.clear()}

thanks a lot @david.pinn.
I was able to get values of my CRM Company field when hitting on “More” in my “Basic” view search.


But, when switching to “advanced” view, I"m still don’t get suggested values as shown in my previous screenshot.
Do you think I need to do something special on another .vm file? Or this is because I"m using my own type of CF.
thanks a lot for your help.
Rosy

1 Like