3

We have a customer community with a custom Visualforce application and a custom login page, so that when you are logged into community you are always in the VF app.

I have created a Url Rewriter class for the community Site. I need to detect whether there is a currently logged-in user or not and redirect accordingly. The redirects are to VF pages within the app.

However, I've found that the context user in the Url Rewriter is always the site guest user, even when I'm logged in to the community. I'm debugging UserInfo.getUserId() in the class, and as I navigate through the VF application, the rewriter debug always shows the guest user.

That is strange because we use UserInfo methods in the VF application itself and they always return the logged-in user.

Salesforce premier support says this is working as designed. Has anyone come up with a good workaround for this?

1

You have no access to UserInfo.xx etc to figure out who the user is, so routes need to be generic, if you need to do user based routing best to bounce the user off a Visualforce page which does have access and can redirect it to a user/profile specific page.

More info here: https://limitexception.com/url-rewriting-on-force-com-sites-and-visualforce-communities-ef26cefeda02

  • Thanks, we decided this morning to go with the process you described. – David Cheng Mar 8 '18 at 19:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.