+3

How to get a list of clients with portal access

Thijs Senten 1 year ago in Client Portal updated by mark 1 month ago 12

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. 



Thijs:

I'm now trying to get a list of clients who have access to the client portal. When I use this code, I only get DEFAULT SERVICES as well. Could you point out the rogue break that you found?


Thanks so much!


Mark 

Hi Mark,

That code will simply let you know which services are available for the client on the portal, not whether or not they were invited. All clients have access to the portal, by default, AFAIK. But you can always remove that access by unchecking Client Portal Access Allowed in Main Data - System Accounts in the client's profile.

Just checked, you can set the default setting for allowing new clients to access the portal. It is in Configuration - Portals - Client Portal.

Thanks.

We're trying to move our server to a self hosted environment, and we realized that we have no idea how many of our clients have accessed the client portal. We wanted to find a simple way to export a list of when the last access date was for a client. Then we could communicate to these clients that the link is changing.


Not sure if that data point is available in XTRF? 

Hi Mark,

Jaime is right - this code will only show you the services. The rogue break was basically a copy paste error.

To show if a client contact has access to the portal we use a custom column with this code. It's from a while back, but I believe one of the two checks if the client company has portal access enabled and the other one checks if the client contact has access. Both need to be 'on' for a contact person to have access.

#if($utils.unwrap($this).isWebLoginAllowed() && $utils.unwrap($this).canLogInToCustomerPortal())
YES
#else
NO
#end

I'm not sure if there is a way to see when the last access happened. There is a getLastLoginDate() method in the ContactPerson class, but I don't think it does much. You could maybe also check for last quote dates with origin Client Portal as a workaround, but that probably doesn't cover all logins.

I'm quite curious now, so let me know if you think of a solution to get this information.

Thanks Thijs. This does help tremendously. For now, I think this is helpful enough until we find a more nuanced solution. Thanks! But if we do figure out how to grab some type of last login date I'll be sure to share.