2 weeks ago
Hi everyone,
We have successfully extended the repository user model (cm:person) by injecting two custom aspects via a repository-side content model:
eng:datosAsociado (contains eng:rolAsociado as d:string)
eng:datosCumpleanos (contains eng:fechaNacimiento as d:date)
This backend implementation has been fully tested, and data is persisting correctly via the Repository JavaScript API and REST API. Now, we want to expose these properties within Alfresco Share UI so administrators can view or update them when creating or editing a user, and users can see them in their own profiles.
Following the advanced inheritance notes outlined in Will Abson's article Adding Custom Aspect Support in Alfresco Share, we added the following configurations to our share-config-custom.xml inside shared/classes/alfresco/web-extension/ to override the standard user forms using replace="true":
<config evaluator="string-compare" condition="userid" replace="true">
<forms>
<form>
<field-visibility>
<show id="cm:userName" />
<show id="cm:firstName" />
<show id="cm:lastName" />
<show id="cm:email" />
<show id="cm:jobtitle" />
<show id="cm:organization" />
<show id="sizeCurrent" />
<show id="sizeQuota" />
<show id="eng:rolAsociado" force="true" />
<show id="eng:fechaNacimiento" force="true" />
</field-visibility>
<appearance>
<field id="cm:userName">
<control template="/org/alfresco/components/form/controls/info.ftl" />
</field>
<field id="cm:firstName">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
<field id="cm:lastName">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
<field id="cm:email">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
<field id="cm:jobtitle">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
<field id="cm:organization">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
<field id="eng:rolAsociado" label="Número de Rol del Asociado">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
<field id="eng:fechaNacimiento" label="Fecha de Nacimiento">
<control template="/org/alfresco/components/form/controls/date.ftl">
<control-param name="showTime">false</control-param>
</control>
</field>
</appearance>
</form>
</forms>
</config>
<config evaluator="string-compare" condition="profile" replace="true">
<forms>
<form>
<field-visibility>
<show id="cm:firstName" />
<show id="cm:lastName" />
<show id="cm:jobtitle" />
<show id="cm:organization" />
<show id="cm:location" />
<show id="cm:telephone" />
<show id="cm:mobile" />
<show id="cm:email" />
<show id="cm:skype" />
<show id="cm:instantmsg" />
<show id="cm:googleusername" />
<show id="cm:userstatus" />
<show id="eng:rolAsociado" force="true" />
<show id="eng:fechaNacimiento" force="true" />
</field-visibility>
<appearance>
<field id="cm:firstName">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
<field id="eng:rolAsociado" label="Número de Rol del Asociado">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
<field id="eng:fechaNacimiento" label="Fecha de Nacimiento">
<control template="/org/alfresco/components/form/controls/date.ftl">
<control-param name="showTime">false</control-param>
</control>
</field>
</appearance>
</form>
</forms>
</config>Even though we copied the full definition of native fields for cm:person along with our forced aspect properties (force="true"), and applied a total replacement of the form layout via replace="true", Share completely ignores the configuration.
The user forms (whether rendering the "My Profile" page or the "Admin Tools > Users" edit grid) keep showing the out-of-the-box native fields only, rendering the custom aspect properties completely invisible.
We verified that the XML file is indeed being parsed by Tomcat (intentionally breaking the XML format immediately crashes the user console with a Failed to parse config stream exception), but valid layout modifications are silently bypassed.
Since the referenced article is from 2010, we suspect the user management dashboards might be decoupled from the standard Surf dynamic forms processor or hardcoded in modern revisions.
Has anyone successfully overridden the userid or profile forms to support custom aspects?
Do modern versions of Share require deploying a dynamic Surf Extension Module (/site-data/extensions) instead of the global share-config-custom.xml to modify cm:person layouts?
Any guidance, workaround, or pointers on how to achieve this would be highly appreciated!
Thanks in advance.
2 weeks ago
I'm sorry I didn't mention that this is Alfresco Community Edition 25.2 on ubuntu 24.04 server.
a week ago
hello.
I make a quick look and the most obvious cause for your problem is that you are using a wrong condition. I dont see those conditions in any of the example config.xml
Also i think those pages are not obtaining its fields from the config.xml, instead they are scripted as a widget
Maybe you need to override the widget
a week ago
Hello jesusmarmol, I´ll try to override the widget, thank you!
Arturo
Explore our Alfresco products with the links below. Use labels to filter content by product module.