Wednesday, 16 November 2016

Using Liferay Services in VM using ServiceLocator

When developing custom themes, we need to use Liferay services in VM. Its quite easy but tricky. So, putting here a simple example-
Write following in init-custom.vm

#set($organizationLocalService = $serviceLocator.findService("com.liferay.portal.
service.OrganizationLocalServiceUtil" )

Now you can use this service as follows:

#set ($org = $organizationLocalService.getOrganization($myPlace.getClassPK($myPlace.getClassPK()))

   

No comments:

Post a Comment