Wednesday, 8 April 2015

How to use Lieray Service without creating portlet

There are 6 simple steps to check / test OOTB Liferay's LocalServiceUtil methods

Step 1: Go to the Liferay login page

Step 2: Login using portal admin

Step 3: Go to the "Control Panel" -> "Server Administration" -> "Script" tab

Step 4: Select the "Javascript" as Language

Step 5: Provide below script under "Script" tab

    // ### Javascript Sample ###

    number = Packages.com.liferay.portal.service.UserLocalServiceUtil.getUsersCount();
    
    out.println(number);

Step 6: Click on "Execute"

Cheers! You are done. Output is available under the "Output" section

FYI, 1) We have used User Local Service to get user count like wise we can use any liferay OOTB service.
        2) Apart from "Javascript", Liferay provides "Beanshell", "Groovy", "Python", "Ruby" languages.

Cheers!
Henal Saraiya
(Senior Consultant)
CIGNEX Datamatics  

No comments:

Post a Comment