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>
Solved! Go to Solution.
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"/>
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"/>
@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
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
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>
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:
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
@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
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.