Monday, July 8, 2013

customAttributes in Liferay

Steps to add customAttributes to user registration page:

* Click on control panel > User > Custom attributes > Add Custom attributes.
 * Here we need to give a key (name) and type of the field.
 * For eg. We will have an Field called Designation added which is a text field.

Key :   Designation

Type : Text-field(Indexed) and save.

* Then add the custom attribute taglib in the create_account.jsp in /tomcat/webapps/ROOT/html/portlet/login as follows:

< liferay ui:custom-attribute-list
            className="com.liferay.portal.model.User"

            classPK="<%= 0l %>"

            editable="<%= true %>"

            label="<%= true %>"

      />


  * But this field will not appear on the create account page because permissions are

 not given.

    * Hence to permission click on action tab of that custom attribute(here eg.Designation) and permissions



    * Here for guest we give permission for view and update.



    * Now in the create account page this field will appear.




TO ACCESS the custom fields in portlet

String Designation = (String)currentUser.getExpandoBridge().getAttribute("Designation").toString();

Service Builder : Errors in Setting Java Heap Size

While running services in liferay we may face with the error 

build-service:
Java Result: 1
Error: Could not create the Java Virtual Machine.Error occurred during initialization of VM
Could not reserve enough space for object heapError: A fatal exception has occurred. Program will exit.


solution :

SDK ,change the file build-common-plugin.xml
       from
jvmarg value="-Xms512m"
jvmarg value="-Xmx1024m"
       to
jvmarg value="-Xms128m"
jvmarg value="-Xmx512m"