Skip to content

Instantly share code, notes, and snippets.

@beeTechMantra
Last active September 13, 2020 05:36
Show Gist options
  • Save beeTechMantra/44f7157ea85329ac15aa40334773aecf to your computer and use it in GitHub Desktop.
Save beeTechMantra/44f7157ea85329ac15aa40334773aecf to your computer and use it in GitHub Desktop.
Get User's Category by userId Groovy script Liferay
import java.util.List
import com.liferay.asset.kernel.model.AssetCategory
import com.liferay.asset.kernel.service.AssetCategoryLocalServiceUtil
import com.liferay.portal.kernel.model.User
try{
// 123456 - here you have to pass userId
List<AssetCategory> assignedCaregories = AssetCategoryLocalServiceUtil.getCategories(User.class.getName(), 123456);
for(AssetCategory category : assignedCaregories) {
out.println("category Name : " + category.getName());
out.println("==========================================");
}
}catch(e) {
out.println(e);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment