1

I have two customer portals say A and B. When i log in into any one of the customer portal, In my apex class i want to identify for which portal i am logged in. Is it possible to identify for which portal you are logged in? If yes, How can i implement this?

  • how are you authenticating the portal users. – anmrk Apr 6 '14 at 14:36
1

Network.getNetworkId() should give you an identifier for the current Community for the currently logged-in user.

  • this is not working for customer portal. – Pankaj Mar 6 '14 at 9:13
  • Oh, Portal. I misread the question. Sorry. – beamso Mar 6 '14 at 11:20
0

I think you can use the Site methods for this: http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_sites.htm

E.g. Site.getName()

I don't have the correct setup available currently to replicate this.

0

Three options that are a bit unorthodox but potentially could do the trick.

  1. In some cases if the two portals do not share common profiles then that may be a way to distinguish which one they are logged into.

    userinfo.getProfileId()

  2. Another option that comes to mind (that I can't verify since I don't have a portal handy) is to look at the current URL and see if there are any differences when a user is logged onto one vs. the other and determine it that way. https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_url.htm

  3. Last would be to place a cookie on the home page of each respective portal and write the portal name in there so you can reference it later when needed. https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_sites_cookie.htm

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.