Pages

Tuesday, 6 January 2015

Consume liferay service in to Theme

Find the liferay service which you want to consume which you can get it from Liferay API
EX:-
if you want consume com.liferay.portal.service.GroupLocalServiceUtil service use the below code in you VM template

#set($usergroupService = $serviceLocator.findService("com.liferay.portal.service.GroupLocalService"))
#set($usergroups=$usergroupService.getUserGroups($user_id))

##$usergroups which will return the list of groups that has been to the logged in user

#foreach($usergroup in $usergroups)
<div id="list of  groups">
$usergroup.getName()
</div>
#end