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?

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

3 Answers 3

1

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

2
  • this is not working for customer portal.
    – Pankaj
    Commented Mar 6, 2014 at 9:13
  • Oh, Portal. I misread the question. Sorry.
    – beamso
    Commented Mar 6, 2014 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .