cancel
Showing results for 
Search instead for 
Did you mean: 

Custom property with dropdown constraint do not show in edit or search form

sepgs2004
Star Contributor
Star Contributor

Environment: Community 5.2.x, Alfresco Maven SDK to generate repo and share tier AMP files

In my last project, I had all my properties in a custom aspect, and some properties with associated constraint (list of values). These properties were showing up as a dropdown in the search and edit forms in share. 

Now I have the properties directly associated to the type (instead of through aspects). Here, I do not see the dropdown list (to pick a value from) in the edit and the search form.

I am in some misunderstanding I believe. Please note that the field is shown as a regular text field.

My constraint:

<constraints>
   <constraint name="mcus:employeeNamesList" type="LIST">
      <parameter name="allowedValues">
      <list>
         <value></value>
         <value>Alan G</value>
         <value>Alex S</value>
         <value>Barb Sindy</value>
         <value>Bert Ser</value>
         ...
      </list>
     </parameter>
      <parameter name="caseSensitive">
         <value>true</value>
      </parameter>
      <parameter name="sorted">
         <value>false</value>
      </parameter>
</constraint>

Here is my type (with the property) defined in my model.

<type name="mcus:financeReceipts">
  <title>Financial Receipts</title>

  <property name="mcus:employeeName">
  <title>Employee Name</title>
  <type>d:text</type>
  <mandatory>false</mandatory>
  <index enabled="true">
    <tokenised>both</tokenised>
  </index>
  <constraints>
    <constraint ref="mcus:employeeNamesList" />
  </constraints> 
</property>

Part of share-config-custom.xml

<config evaluator="model-type" condition="mcus:financeReceipts">
	<forms>
		<!-- Search form -->
		<form id="search">
			<field-visibility>

				<!--custom-->
				<show id="mcus:employeeName"/>
			</field-visibility>

			<appearance>

				<!--custom-->
				<field id="mcus:employeeName" label-id="mcus.employeeName">
				<control template="/org/alfresco/components/form/controls/textfield.ftl" />
				</field>
			</appearance>
		</form>
	</forms>
</config>
Gnanasekaran Sakthivel
1 ACCEPTED ANSWER

abhinavmishra14
World-Class Innovator
World-Class Innovator

It will be displaying property if the property on the form when aspect is applied (considering the property is defined in an aspect and aspect is not mandatory) to the node or property is present on the node (Check node browser using the nodeRef and see if you can see the newly added property). 

Have a look at share forms documentation shared earlier. It is worth looking at. 

if you want the property to display always, you can force it. 

Update the field definition as:

<show id="mcus:employeeName" force="true"/>
~Abhinav
(ACSCE, AWS SAA, Azure Admin)

View answer in original post

6 REPLIES 6

abhinavmishra14
World-Class Innovator
World-Class Innovator

It will be displaying property if the property on the form when aspect is applied (considering the property is defined in an aspect and aspect is not mandatory) to the node or property is present on the node (Check node browser using the nodeRef and see if you can see the newly added property). 

Have a look at share forms documentation shared earlier. It is worth looking at. 

if you want the property to display always, you can force it. 

Update the field definition as:

<show id="mcus:employeeName" force="true"/>
~Abhinav
(ACSCE, AWS SAA, Azure Admin)

@abhinavmishra14 Thx.
Do you know why the following could occur?
In Share UI, when you hover over a document, and click "Edit Properties", Employee Name property shows up (still without the drop down). Then there is an "All Properties" edit on the right. When I click that, another form loads up, and it does not show the "Emlpoyee Name" property.
Could I be missing something?
In the share-config-custom.xml, I did put this property on the following configurations:
node-type, form doclib-simple-metadata
node-type, form doclib-inline-edit
model-type, form search





Gnanasekaran Sakthivel

i missed to see this:

<control template="/org/alfresco/components/form/controls/textfield.ftl" />

You are creating property for contartint list but using a template for textfield, which may also be causing the issue. 

Can you please remove it and let forms framework use default template (selectone.ftl) ?

Note you can not show a property with constraint as a text field.

It should just be:

<field id="mcus:employeeName" label-id="mcus.employeeName"></field>

or
<field id="mcus:employeeName" label-id="mcus.employeeName">
  <control template="/org/alfresco/components/form/controls/selectone.ftl" />
</field>
~Abhinav
(ACSCE, AWS SAA, Azure Admin)



node-type, form doclib-simple-metadata
node-type, form doclib-inline-edit
model-type, form search




@sepgs2004  See the differences below.

Types of config evaluators (<config evaluator=”..” condition=”..”>)

model-type

model-type config evaluator is used to define a “create form config” which is used to create custom content/node. We also configure Advance search forms under model-type config evaluator

node-type

node-type config evaluator is used to define a “view/edit form config” which is used to view the metadata or edit the metadata of a node.

aspect

aspect config evaluator is also used to define a “view/edit form config” which is used to view the metadata or edit the metadata of a node but this is configured against an aspect. If the aspect is applied to a node then only this form is visible, else it is hidden.

string-compare

string-compare config evaluator is used to define config for DocumentLibrary, DocLibActions, DocLibCustom, DocumentLibraryViews, AdvancedSearch, Search, SearchLibCustom, Users, RepositoryLibrary and any custom itemKind (used to load a form pertaining to an action).

etc....

Now, when it comes to forms....

Following are the form Ids:

  • Default (form element with no id attribute). This is the form displayed when you open the document details. It is also known as “doclib-common. It is default form id. 
  • A form called doclib-simple-metadata”. This is used when you edit properties from the document library, You click on actions menu on each node and select edit properties.
  • A form called “doclib-inline-edit”. This is used when you click the “Inline Edit” UI action. Valid only for text, html, xml etc. types of content and alfresco by default applied inline editable aspect on these types of nodes to show the action. 
  • A form called search”. This is used when you select a type to search from Advance search page.

You choose the evaluator on a condition and decide which form you want to use. 

In your case, your goal seems to be showing the property on "doclib-simple-metadata", “doclib-common” (default) and "search". 

Here are examples:

<config evaluator="model-type" condition="mcus:financeReceipts">
	<forms>
		<!-- Search form -->
		<form id="search">
			<field-visibility>
				<!--custom-->
				<show id="mcus:employeeName" force="true"/>
			</field-visibility>
			<appearance>
				<!--custom-->
				<field id="mcus:employeeName" label-id="mcus.employeeName"/>
			</appearance>
		</form>
	</forms>
</config>


<config evaluator="node-type" condition="mcus:financeReceipts">
	<forms>

		<!-- default form, id can be left empty as it will consider 'doclib-common' as default id -->
		<form>
			<field-visibility>
				<!--custom-->
				<show id="mcus:employeeName" force="true"/>
			</field-visibility>
			<appearance>
				<!--custom-->
				<field id="mcus:employeeName" label-id="mcus.employeeName"/>
			</appearance>
		</form>
		
		<form id="doclib-simple-metadata">
			<field-visibility>
				<!--custom-->
				<show id="mcus:employeeName" force="true"/>
			</field-visibility>
			<appearance>
				<!--custom-->
				<field id="mcus:employeeName" label-id="mcus.employeeName"/>
			</appearance>
		</form>
	</forms>
</config>

I would recommend to go through this whole doc once:

https://docs.alfresco.com/5.2/references/forms-reference.html

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

Afer setting forced=true things show up. Crazy!
Still, I could not get the drop down to appear for the properties that have list constraint

Gnanasekaran Sakthivel


@abhinavmishra14 wrote:

It will be displaying property if the property on the form when aspect is applied (considering the property is defined in an aspect and aspect is not mandatory) to the node or property is present on the node (Check node browser using the nodeRef and see if you can see the newly added property). 

Have a look at share forms documentation shared earlier. It is worth looking at. 

if you want the property to display always, you can force it. 

Update the field definition as:

<show id="mcus:employeeName" force="true"/>

Glad it worked for you. good luck @sepgs2004 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)