1
votes

Is it possible to customize or override the salesforce logout method in apex? I want to do some thing custom when user goes to logout salesforce account. enter image description here

2
Have you tried Event monitoring in salesforce ? - Sudarshan

2 Answers

2
votes

You screenshot shows the standard logout link which can not be customized.

You can customize the "logout" flow in a community using custom code by having a custom logout link which calls a controller action which wraps the standard logout function but this is only in a case where you are not using the standard header and can implement a custom link for logging out.

1
votes

The logout flow of salesforce is a standard anchor tag call with a href to a link. If you inspect the element you can see that.

<a href="/secur/logout.jsp" class="menuButtonMenuLink" title="Logout">Logout</a>

Unfortunately, there is no controller where the control comes after a click of the LogOut option. The only way you can get some control is, if you customize your logout URL and make salesforce redirect to it after it logs itself out. In that way, you can solve the branding issues but can not do anything related to the user as the user context is lost as soon as salesforce logs out itself.

Though in the idea forum there are ideas for doing that but looks like Salesforce is not doing anything in that front.

Hope this helps.