How to check whether user logged in as portal user or community user through apex.
Through that i have to redirect to different Visual force pages.
Requirement:
For community user i have to keep one vf page for new case and portal user i have to keep another vf page for new case.
Thanks,
Suresh.
Best Answer
I would not use the Profile name, as suggested by Saroj. You could have multiple different Profiles within your Portal/Community, so you would have to add lots of clauses to the conditions where you check the Profile Name. And also, admins can easily change the name of the Profile, which would break your code.
Instead, I would use User.UserType, as described here:
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_user.htm#profilelicensetype
You can get this value by using UserInfo.getUserType()