+ Start a Discussion

Custom button not working as expected in a embedded vf page in stad layout

Custom New button in a vf page embedded in Standard page is working as expected for system admin. But for other users if the New button is clicked, it opens on the same vf page which is embedded in standard page.

Also the cancel button (std button) on the contact page redirects to the vf page as a separate section not to the account std page.

Can anyone help me on this.
William TranWilliam Tran
Please provide more information including screen prints.

User-added imageUser-added imageUser-added image
First screenshot showing the embedded vf page on the std pagelayout.
2nd showing the contact page opening from the new button inside the embedded section of the vf page itself inside std page.
3rd showing , by clicking cancel redirecting to the same embedded section with different view.
William TranWilliam Tran
As far as I can tell, this is working as expected.  When "New" is click what is the destination? another apex page or standard out of the box page?

if you can paste the "new" button code.

Also is "cancel" a custom button on a custom page or a standard button on a standard page?  If custom, what is the code behind it.

William TranWilliam Tran
Also, it looks like you are new to the developer forum, welcome!

As a common practice, if your question is answered, please choose 1 best answer. 
But you can give every answer a thumb up if that answer is helpful to you. 

This will help keep the forum clean and help future users determine what answers are useful
and what answer was the best in resolving the user's issue. 


Below is the code for the New button, which redirects to the Standard Contact page.
<apex:form ><apex:commandButton value="New Contact" action="{!URLFOR($Action.Contact.NewContact,null,[con4_lkid=id],true)}"/> </apex:form>

Cancel button is std button on the standard contact page.
William TranWilliam Tran
This is working as expected because they are standard button/page behavior.

but you can hack your new button to direct the save/cancel to any page you want.

{!URLFOR($Action.Contact.NewContact,null,[con4_lkid=id,saveURL=SAVEDESTINATION, retURL=CANCELDESTINATION],true)}

where SAVEDESTINATION and CANCELDESTINATION = anywhere even an apex page like /apex/yourpage