You need to sign in to do that
Don't have an account?
reem sharawy
command button open new tab
Hello
I added a new button on my page to be able to create new opportunity from a visualforce page which replace the opportunity related leist on the account detailed page, the problem is that button doesn't open a new tab and opens in the exisiting Vf page
I added a new button on my page to be able to create new opportunity from a visualforce page which replace the opportunity related leist on the account detailed page, the problem is that button doesn't open a new tab and opens in the exisiting Vf page
<apex:page standardController="Account" extensions="AccountOpportunityTabExtension"> <html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <apex:form style="height: 800px;"> <apex:tabPanel > <!-- Add Different Tabs Like the one below --> <apex:tab label="{!$Label.Construction_All_Opportunity}" style="overflow: auto; height: auto;"> <apex:pageBlock > <apex:commandButton value="New" action="/apex/Opp_layout_new_edit?oppId={!Account.id}"/> <!--<Apex:commandButton value="New" onclick="window.open=(/apex/Opp_layout_new_edit?oppId={!Account.id}','_blank')" /> --> <apex:pageBlockSection id="contructionSection" collapsible="false" columns="1"> <apex:pageBlockTable value="{!constructionPaginationBaseObject.objectPageList}" var="opportunity"> <!--<apex:commandButton> <apex:commandLink value="New" action="/apex/Opp_layout_new_edit?oppId={!opportunity['opportunityId']}" target="_blank"/> </apex:commandButton> --> <apex:column > <apex:outputLink title="" value="/{!opportunity['opportunityId']}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-weight:bold" target="_blank">Edit</apex:outputLink> </apex:column> <apex:column headerValue="Opportunity Name"> <apex:commandLink action="/{!opportunity['opportunityId']}" value="{!opportunity['OpportunityName']}" target="_blank"/> </apex:column> <!--<apex:column headerValue="Purchase Type" value="{!opportunity['PurchaseType']}" />--> <apex:column headerValue="Stage" value="{!opportunity['StageName']}" /> <apex:column headerValue="Amount" value="{!opportunity['Amount']}" /> <apex:column headerValue="Order Date" > <apex:outputText value="{0,date,dd/MM/yyyy}"> <apex:param value="{!opportunity['CloseDate']}" /> </apex:outputText> </apex:column> <apex:column headerValue="Owner Full Name"> <apex:commandLink action="/{!opportunity['opportunityId']}" value="{!opportunity['Owner']}" target="_blank"/> </apex:column> </apex:pageBlockTable> <apex:outputPanel > <apex:commandButton value="|< First" action="{!constructionPaginationBaseObject.firstAction}" reRender="contructionSection" disabled="{!NOT(constructionPaginationBaseObject.hasPrevious)}" /> <apex:commandButton value="< Previous" action="{!constructionPaginationBaseObject.previousAction}" reRender="contructionSection" disabled="{!NOT(constructionPaginationBaseObject.hasPrevious)}" /> <apex:outputText value="Page {0} of {1}"> <apex:param value="{!constructionPaginationBaseObject.currentPageIndex + 1}"/> <!-- Adding 1 because this is zero indexed --> <apex:param value="{!constructionPaginationBaseObject.pageCount}"/> </apex:outputText> <apex:commandButton value="Next >" action="{!constructionPaginationBaseObject.nextAction}" reRender="contructionSection" disabled="{!NOT(constructionPaginationBaseObject.hasNext)}" /> <apex:commandButton value="Last >|" action="{!constructionPaginationBaseObject.lastAction}" reRender="contructionSection" disabled="{!NOT(constructionPaginationBaseObject.hasNext)}" /> </apex:outputPanel> </apex:pageBlockSection> </apex:pageBlock> </apex:tab> </apex:tabPanel> </apex:form> </html> </apex:page>
go to below link for your solution
http://www.infallibletechie.com/2013/09/how-open-in-new-tab-for-pagereference.html
i hop it helps you
Let me inform if it helps you and mark it best answer if it helps you so it make proper solution for others :)
thanks
All Answers
my url is https://c.cs87.visual.force.com/apex/Opp_layout_new_edit?retURL=%2F0018E00000By5vZ&accid=0018E00000By5vZ&CF00Nb00000030RDB=test+account&CF00Nb00000030RDB_lkid=0018E00000By5vZ&CF00Nb00000030RDC=&CF00Nb00000030RDC_lkid=&save_new=1&sfdc.override=1
apex/Opp_layout_new_edit?retURL=%2F0018E00000By5vZ&accid=0018E00000By5vZ&CF00Nb00000030RDB=test+account&CF00Nb00000030RDB_lkid=0018E00000By5vZ&CF00Nb00000030RDC=&CF00Nb00000030RDC_lkid=&save_new=1&sfdc.override=1
Thanks
<Apex:commandButton value="New" onclick="window.open('{!apex/Opp_layout_new_edit?retURL=%2F0018E00000By5vZ&accid=0018E00000By5vZ&CF00Nb00000030RDB=test+account&CF00Nb00000030RDB_lkid=0018E00000By5vZ&CF00Nb00000030RDC=&CF00Nb00000030RDC_lkid=&save_new=1&sfdc.override=1}');" />
go to below link for your solution
http://www.infallibletechie.com/2013/09/how-open-in-new-tab-for-pagereference.html
i hop it helps you
Let me inform if it helps you and mark it best answer if it helps you so it make proper solution for others :)
thanks
Didn't know you could turn a commandLink into a button. Excellent.
<apex:commandlink action="{!actionMethod}" target="_blank">
<apex:commandButton value="Button Label"/>
</apex:commandLink>