DEVCON 2026    |    2-5 November 2026 – QEII Centre – London, UK    |    Register now! 

Blogs

Searching entities through custom attribute value.

Sushil Patidar
Sushil Patidar
Minder dan een minuut lezen

If you need to search Users who has particular custom attribute value .Using liferay expando API ,this can be acheived easly as follows.

String attrValue ="IT";
 
String attributeName ="user-department-name";
 
String tableName = ExpandoTableConstants.DEFAULT_TABLE_NAME;
 
long classNameId = ClassNameLocalServiceUtil.getClassNameId(User.class);
 
 
List<ExpandoValue> expandoValues =ExpandoValueLocalServiceUtil.getColumnValues(companyId, classNameId, tableName, attributeName, attrValue, -1,-1);
 
 
for(ExpandoValue expandoValue:expandoValues)
 
  try {
      long userId = expandoValue.getClassPK();
      User user  =UserLocalServiceUtil.getUser(userId);
  }
  catch(NoSuchUserException nsue) {
 
   _log.error("No Such User Exist");
  }
}
 

 

Paginareacties

Related Assets...

Geen resultaten gevonden

More Blog Entries...

Ben Turner
september 02, 2026
David H Nebinger
augustus 18, 2026
David H Nebinger
augustus 16, 2026