You need to sign in to do that
Don't have an account?
johncusackjr
Is there a Customer Portal Flag?
Hi all,
How can I tell my Visualforce page is accessed from customer portal?
Is there a profile, permission or system flag that i can check?
Thanks,
John
This can be achieved by using the SOQL query in apex. Go through the sample code given below :
User usr = [Select ContactId, Profile.Name,IsPortalEnabled from user where Id=: UserInfo.getUserId()];
if (usr.IsPortalEnabled = true){// your business logic here}
Hope this helps.
Thanks Pradeep_Navatar
It worked!
Hi again Pradeep,
Your suggestion didn't solve the problem for Professional Edition accounts.
When my customers try to install the application that check fails in Professional Edition:
User usr = [Select ContactId, Profile.Name,IsPortalEnabled from user where Id=: UserInfo.getUserId()];
if (usr.IsPortalEnabled = true)
{
// your business logic here
}
I tried this in System Log of a Professional account:
User usr = [Select IsPortalEnabled from user where Id=: UserInfo.getUserId()];
System.debug('Customer Portal user' + usr.IsPortalEnabled);
and got this error:
Compile Error: line 1, column 12: No such column 'IsPortalEnabled' on entity 'User'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
But this works flawlessly on a Enterprise/Developer account.
Do you have any other suggestion to fix this?
Thanks,
John
I found below workaround in Apex
You can find list of User Type's in http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_user.htm
Thanks,
John