+2

How to get a list of clients with portal access

Thijs Senten 9 months ago in Client Portal updated by Bartosz Budzyński 9 months ago 6

Is there a way to filter to a list of clients that have portal access enabled? I may be looking wrong, but I didn't find a filter for this in the client view.

Ultimately, what I want is to get a list of services per client portal - any idea how to do this easily (or at all)?

+2

This can be done  using a custom column. To use it, you'll have to

1) Go to Settings -> Custom Fields and Coluns -> Custom Columns -> Add Custom Column
2) Choose Client as Class Name and Groovy as Script Language, enter Name for this column. Don't worry about the rest
3) In Expression field, please paste this code:

def portalSettings = unwrappedThis.getPortalSettings()
if(portalSettings.isUseDefaultCustomerServices()) return "DEFAULT SERVICES"
else { 
    def licensedProjectService = utils.getService("com.radzisz.xtrf.service.license.LicencedProjectsService")
    def availableServices = portalSettings.getServices(licensedProjectService)*.getName()
    output = "" 
    availableServices.each { output += "$it\n" }
}

return output


4) Go to Clients module, edit view and add newly created column.

Hi Mateusz,

Thanks so much for this! 

Unfortunately, the output is not entirely as expected: all clients show 'DEFAULT SERVICES', except for the ones where we changed those default services, but then only a dash is shown. Any idea why this is?

Hi Thijs,

Whenever you have a checkbox "Use default settings" checked under "Available services" it will show DEFAULT SERVICES.

Would you like to display all services regardless?

Weird thing about the dash - are you sure there are services actually set for those clients? 

Thanks,

Bartosz

Hi Bartosz,

I'm happy with DEFAULT - it's the custom services that I'd also like to see. Right now the dash is not giving me the info I need.

There definitely are services set for those clients.


Any clue?

Hi Bartosz,

I found the error - there was a rogue break somewhere. It works now - thanks so much!

Hi, 

Great that you figured it out! Glad to help.