Hello Friends,
Do you know the use of Beanshell script which is coming up with Liferay control panel ?
If you go to Liferay control panel >> Server Administration section,
there is one tab available to run the bean shell script directly . See below screen shot
Here if you see drop down, you can execute Java,javascript,Groovy,Python,Ruby language code directly.
So its sometimes very useful if you want to run some Liferay API and want to add ot update data.
Let say i want to change all user's time zone to EST then you can run below code directly in beanshell script and can apply that data instead of running SQL manually.
userList= com.liferay.portal.service.UserLocalServiceUtil.getUsers(-1,-1);
for(com.liferay.portal.model.User user : userList){
user.setTimeZoneId("America/New_York");
com.liferay.portal.service.UserLocalServiceUtil.updateUser(user,true);
out.println(user .getFirstName() +" : "+user.getTimeZone().getDisplayName()+" : "+user.getTimeZone(). getID());
}
Give a try once and get benefits of this !!!!!!!
Do you know the use of Beanshell script which is coming up with Liferay control panel ?
If you go to Liferay control panel >> Server Administration section,
there is one tab available to run the bean shell script directly . See below screen shot
Here if you see drop down, you can execute Java,javascript,Groovy,Python,Ruby language code directly.
So its sometimes very useful if you want to run some Liferay API and want to add ot update data.
Let say i want to change all user's time zone to EST then you can run below code directly in beanshell script and can apply that data instead of running SQL manually.
userList= com.liferay.portal.service.UserLocalServiceUtil.getUsers(-1,-1);
for(com.liferay.portal.model.User user : userList){
user.setTimeZoneId("America/New_York");
com.liferay.portal.service.UserLocalServiceUtil.updateUser(user,true);
out.println(user .getFirstName() +" : "+user.getTimeZone().getDisplayName()+" : "+user.getTimeZone(). getID());
}
Give a try once and get benefits of this !!!!!!!