Skip to Content

How to get all customers

Hello,

I am trying to create a List with all customers. For as far as I can see, I can get one user at a time (be it the current user, or a userFromUid)

this is what I had been able to do: final CustomerModel cm = (CustomerModel) userService.getUserForUID();

Can anyone tell me how I can get all customers?

Thanks in advance!

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 16, 2014 at 01:58 PM

    I believe you can get the users from getUserService().getUserGroup().getMembers() ;

    This will return all the users.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 16, 2014 at 02:33 PM

    If you're looking for a specific set of users, then try and use a flexible search query. This would be more efficient than returning all the users in a group and then iterating over them.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 12, 2018 at 09:52 AM

    @Vinay

    Please note that usergroup.getMembers() will not give you all Users directly, but a hierarchical Structure (Principals) instead. e.g. is willl give you something like this:

     - John Doe (CustomerModel)
     - Jane Doe  (CustomerModel)
     - Subusergroup 1 (UsergroupModel)
     --SubSubUsergroup 1 (UsergroupModel)
     --- Mr. X  (CustomerModel)
     --- Mr. Y  (CustomerModel)
     -- Mrs. Z  (CustomerModel)
     - Foo Bar  (CustomerModel)
    
    

    to get all CustomerModels, you'd have to write a function that collects all users from sub-groups as well. Or, as an alternative, you could work with Flexible Search/ Write a Dao.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.