function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Madhura BMadhura B 

Determine Profile when Logging in as Portal User

Hi,

 

I would like to perform certain actions on the customer portal only when the portal user has logged in from the site login page.

In other words, when the system admins logs in as Portal user certain actions shouldn't take place.

Is there a way to differentiate if the user has logged in from the site login page or from the platform by clicking on 'Login As Portal User'  button on the Contact detail page?

 

 

Thanks!

Best Answer chosen by Madhura B
prakash_sfdcprakash_sfdc

Hi,

 

There will be little difference in the portal/site URL and the URL generated when you login from salesforce.

You can use URL Methods to search for some string in the URL and if that string is present, do the operation else not.

 

//Apex Code

 

String currentURL=String.valueOf(System.URL.getCurrentRequestUrl());

if(currentURL.contains('searchWord')

{

 //Code

}

else

{

 //Code

}