google.com, pub-5747754088801811, DIRECT, f08c47fec0942fa0 Skip to main content

Add custom field in user expando api liferay 6.2

Custom Field Liferay


1) The easiest way to add customfield is  add customfield with control panel.

  1. Admin -> Control panel -> Configuraton -> custom fields -> Click user -> Add custom field -> Add key and Type (e.g key - nickname type - Text field index)
  2. Click on save Now you done.
  3. Create One Hook Liferay -> https://www.liferay.com/documentation/liferay-portal/6.2/development/-/ai/customize-and-extend-functionality-hooks-liferay-portal-6-2-dev-guide-en
  4. Override html\portlet\users_admin\user\details.jsp
  5. Add below code in jsp for the custom field nickname.
   <div class="exp-ctrl-holder">
           <liferay-ui:custom-attribute
             className="<%= User.class.getName() %>"
             classPK="<%= (selUser != null) ? selUser.getUserId() : 0 %>"
              editable="<%= true %>"
              label="<%= true %>"
              name="nickname"
 />
</div> 

     6 You have done Your work. Deploy hook.
     7 Now Try to create one user and test functionality.
     8 You require to put above code wherever you want to show custom field.
ease mail me if you find any problem in above  tusharpatel88@gmail.com or comment below.





Comments

Popular posts from this blog

Disable cache content of browser access on back button after logout liferay dxp

Some time we have requirement where we do not want to allow back button after logout and show cached browser content. Liferay provide properties which with we are able to restrict to see content on back button after logout. If user click back button after logout it will show the login page. We require to provide below properties in portal-ext.properties. Restart the server once applying below properties browser.cache.signed.in.disabled=true

Start open office in linux through command for liferay

Some time liferay not generate preview and not allow conversion from word to pdf etc. The reason can be it is not started with root access. Please fire below command to start soffice with the root access. First Kill the soffice proccess. pkill -9 soffice Execute below command to run it sudo soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard &