+ Start a Discussion
Baguiar2Baguiar2 

apex:commandButton save and logout

HI,

 

is there a way I can do it in VF that the command button simply save the record and Logs the current user out ? Maybe through the apex:commandButton action ?

 

This is a simple VF page that would be handed out to a customer , no back buttons and no access to anything. The issue is that after saving the record through the VF page, SF goes directly to the lead record . IS there a way I can avoid that , logout and redirect to a diferent URL?  Or maybe better ideas ? :)

 

Thanks!

 

B

AmitSahuAmitSahu
Your requirement is not so clear . But yes you can redirect the way you want..
AmitSahuAmitSahu
By the way you can try site for that purpose.
Baguiar2Baguiar2

Thanks for responding!

 

The requirement is simply the action on the button on the VF page to SAVE and then, Log out of SF. The best way really would be to SAVE, LOGOUT from Salesforce, and redirect to an URL.

 

Thanks again!

 

B

Baguiar2Baguiar2

humm.. i've tried onclick="navigateToUrl('http://www.gotothis.com');" and it worked on the sandbox. Tried to copy to production and it doesn;t work.. code is exactly the same.  

 

I know this just Navigates to a diferent URl but is part of the solution. not sure why doesn;t it work in the Sandbox...

Baguiar2Baguiar2

Here is what I tried and it worked perfectly in the Sandbox, but in production, after clicking on the button, it goes to the standard LEad record page and it does not logout.

 

<apex:commandButton value="Save" action="{!Save}" onclick="navigateToUrl('/secur/logout.jsp');"/>

 Not sure why it doesn;t work in production....

AmitSahuAmitSahu

The kind of users you are mentioning in this, are they salesforce users just to add leads or they have other stuff to work on in the salesforce?